Skip to main content

A simple python client for the VirgoCX API

Project description

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 code:

import urllib3

urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

or you can use the environment variable PYTHONWARNINGS to suppress the warnings:

export PYTHONWARNINGS="ignore:Unverified HTTPS request"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vcx_py-1.1.3.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

vcx_py-1.1.3-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file vcx_py-1.1.3.tar.gz.

File metadata

  • Download URL: vcx_py-1.1.3.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.8

File hashes

Hashes for vcx_py-1.1.3.tar.gz
Algorithm Hash digest
SHA256 fa34efbefe91e584a930b184b1a64474608f7d5a76c33dde624d8ff1fc613e23
MD5 01e7f6410c303c3c51d5ad73445f9f0d
BLAKE2b-256 5f10c919505e6137665d46c265e14c3486976aa2d6c75ed5fdc1d456ed847815

See more details on using hashes here.

File details

Details for the file vcx_py-1.1.3-py3-none-any.whl.

File metadata

  • Download URL: vcx_py-1.1.3-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.8

File hashes

Hashes for vcx_py-1.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9e60c639451be14496d17a7ebb0e57486fc3f784ab9191f8789d25d4332a6739
MD5 8a59b4a07124754d0ce956e3b1bf9b25
BLAKE2b-256 8f668bf24087bfeb2c496b8752c443a9ce0eee8123c7c844fd3d082f8e432358

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page