Skip to main content

VirgoCX Python Client

A simple Python client for the VirgoCX API.

For more information on the REST api on which this was built, please refer to the VirgoCX API Documentation.

If you are registering for a new account, please consider using my referral code (t74uUoso) or following this link to the registration page which will automatically apply the code.

Table of Contents

Setup

API Keys

Generate your API key and secret from the VirgoCX website. Ensure that the IP address of the machine you are running this client from is whitelisted.

Installation

From PyPi

You can install this package from PyPi by running the following command in your terminal:

pip install vcx-py

From Source

After setting up your environment, install this package from source by running the following command in the root directory of this project:

pip install . # Install the package to your environment

Usage

VirgoCXClient

Create a new instance of the VirgoCXClient class with your API key and secret.

import vcx_py as vcx

vc = vcx.VirgoCXClient(api_key='your_api_key', api_secret='your_secret')

Get KLine Data

Get KLine data for a specific trading pair.

kline_data = vc.get_kline_data(symbol="BTC/CAD", period=vcx.Enums.KLineType.Minute)

Get Ticker Data

Get ticker data for a specific trading pair.

ticker_data = vc.get_ticker_data(symbol="BTC/CAD")

Or for all trading pairs.

ticker_data = vc.tickers()

Account Information

Get account information.

account_info = vc.account_info()

This will give you information regarding your balances across all trading pairs.

Query Orders

Retrieve your orders for a particular trading pair, optionally limited by order status.

orders = vc.query_orders(symbol="BTC/CAD", status=vcx.Enums.OrderStatus.CANCELED)

Query Trades

Retrieve trade (matching) information for a particular symbol.

trades = vc.query_trades(symbol="BTC/CAD")

Place Order

Place a new order.

re = vc.place_order("USDC/CAD", vcx.Enums.OrderType.MARKET, vcx.Enums.OrderDirection.SELL, qty=30)

Note that on success, the response (a dict) will contain the order ID.

Cancel Order

For a specified order ID, cancel the order.

vc.cancel_order(order_id=12345)

Get Discount

Returns similar output as ticker for a given symbol (or all symbols if one is not provided) with your account discount applied to prices.

discount = vc.get_discount(symbol="BTC/CAD")

Warnings

Note that due to CloudFlare protection, this version of the client attempts to access the API through its IP address and not the domain name. Should the IP address change, the client will need to be updated. Moreover, you will receive InsecureRequestWarning warnings when using the client until this issue is resolved. To suppress these warnings, you can use the following to disable such warnings from being emitted by this package:

from vcx_py import STOP_URLLIB_INSECURE_WARN

STOP_URLLIB_INSECURE_WARN.set()

Paused Trading

It is possible that trading on the exchange is paused. Unfortunately, the client does not have a way to check if trading is paused and thus KeyError exceptions may be raised when attempting to access keys from the API which are omitted in such cases. Eventually we hope to have an endpoint which will allow us to check if trading is paused.

Metadata

Release files for vcx-py 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vcx-py 1.2.0
File Size Uploaded
vcx_py-1.2.0.tar.gz 9.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for vcx-py 1.2.0
File Interpreter ABI Platform
vcx_py-1.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 20.9 kB

Release files / vcx_py-1.2.0.tar.gz

Download URL vcx_py-1.2.0.tar.gz
Size 9.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ae1d70976299ca1b6fe8eea6199bdcb8bab15f4f00d6c58ebbd2f69af51e065e
BLAKE2b-256 checksum
How to use checksums
9215b1c8f4e56605e1aff25005097f0ce3fd466c4e146623e01aee5fda0fa0b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.8

Release files / vcx_py-1.2.0-py3-none-any.whl

Download URL vcx_py-1.2.0-py3-none-any.whl
Size 11.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7bfcb5deeadbd0b3d67e29b3c07c0c05662c19c64556aace0bf39de0da4a1254
BLAKE2b-256 checksum
How to use checksums
94904ed5b8ce2b992389a7fb28482d7636e542d5f4036079129bf9ce6f4105d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.8

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page