Skip to main content

A simple GateCoin REST API client

Project description

Gatecoin Python REST API client

This is a simple Gatecoin python REST API client library that abstracts away the REST for the end user.

Installation

The library can be collected from PyPI like so:

$ pip install gatecoin_api

Usage

The package exposes the GatecoinAPI client class which has methods from the Gatecoin REST API. Public methods may be directly used, for trading methods API credentials need to be set:

api = GatecoinAPI('private_key', 'public_key')

or

api = GatecoinAPI()
api.set_credentials('private_key', 'public_key')

After that trading APIs may be used. Example usage of the Public API:

api = GatecoinAPI()
res = api.get_currency_pairs()
print(res.response_status.message) # 'OK'
print(res.currency_pairs[0].trading_code) # 'BTCEUR'
print(res.currency_pairs[0].base_currency) # 'BTC'
print(res.currency_pairs[0].price_decimal_places) # 1

Implemented methods

  • Trading
    • set_credentials
    • get_balances
    • get_balance
    • get_open_orders
    • get_open_order
    • create_order
    • cancel_order
    • cancel_all_orders
    • get_trade_history
  • Public
    • get_currency_pairs
    • get_market_depth
    • get_order_book
    • get_recent_transactions

Development

To develop or test using this package without installing from PyPI, you can clone the repository and set up the environment in a virtual envirnonment at the root of the working copy:

$ virtualenv venv --python=python3

Activate the virtual environment:

$ source venv/bin/activate

Install development dependencies:

$ pip install -r requirements.txt

Run the interactive python shell and you can use the package as the example given below:

$ python
>>> from gatecoin_api import GatecoinAPI as GA
>>> api = GA()
>>> res = api.get_currency_pairs()
>>> res.response_status.message
'OK'
>>> res.currency_pairs[0].trading_code
'BTCEUR'
>>> res.currency_pairs[0].base_currency
'BTC'
>>> res.currency_pairs[0].quote_currency
'EUR'
>>> res.currency_pairs[0].display_name
'BTC / EUR'
>>> res.currency_pairs[0].name
'BTC / EUR'
>>> res.currency_pairs[0].price_decimal_places
1

Tests

To setup correctly for tests, set valid development API keys and API base URL in your shell environment:

export GTC_TESTS_PRIVATE_KEY=<PRIVATE_KEY>
export GTC_TESTS_PUBLIC_KEY=<PUBLIC_KEY>
export GTC_API_BASE_URL=<API_BASE_URL>

For Windows command line, please use the set command:

set GTC_TESTS_PRIVATE_KEY=<PRIVATE_KEY>
set GTC_TESTS_PUBLIC_KEY=<PUBLIC_KEY>
set GTC_API_BASE_URL=<API_BASE_URL>

To run tests please execute:

$ python setup.py test

If development keys are not set, trading scope tests will fail.

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

gatecoin_api-1.0.0.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gatecoin_api-1.0.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file gatecoin_api-1.0.0.tar.gz.

File metadata

  • Download URL: gatecoin_api-1.0.0.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0

File hashes

Hashes for gatecoin_api-1.0.0.tar.gz
Algorithm Hash digest
SHA256 2427ab88267920f5f4c98ae45175fc728bd6f8d39c469f2cccaa12b8a56de27c
MD5 36f5fd229814c5a892ac7ee40d5dd642
BLAKE2b-256 16313c82d1f021c825aa6e1186a09eeaaa202f505615930719696d2567bf6f00

See more details on using hashes here.

File details

Details for the file gatecoin_api-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: gatecoin_api-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0

File hashes

Hashes for gatecoin_api-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 627877a695f1833a02bd4dd35c65514c651330e6edbf4e940055207945adb9ca
MD5 abe7f2711ef4d4dd134459539885b053
BLAKE2b-256 2669ee638fc77137d44c765a70286ffa4c1725667337b4f9c1b4f6f45e9d5a04

See more details on using hashes here.

Supported by

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