Onetoken-trade 0

OneToken Trade System Python SDK

Keywords python, quant, trading Install pip install onetoken-trade==0.1.Two

SourceRank Four


OneToken is a application to fetch tick and play with orders. OTS is a friendly python wrapper for ws API and restful API which will be introduce here, users can use API directly spil they like

  1. Streaming contract tick(via Quote).
  2. Place, amend, pantalla orders(via Account).
  • bitmex
  • okex
  • binance
  • bithumb
  • huobi.professional
  • bitfinex
  • bitstar
  • bittrex
  • poloniex
  • gate
  • exx
  • coinegg

Presently the support of other exchanges is still under development.

Then use onetoken with invoer onetoken spil ot ter python script.

Attempt Quote and Account class, the code is ter ‘./example’

if you don’t want to install this package, set the PYTHONPATH

To attempt Account, prepare your api_key and api_secret, then:

api_key and api_secret will be required te the console.

time, price, volume, bids, asks, contract, source, exchange_time, amount

some property function:

last, bid1, ask1, weighted_middle

parse to or from other forms:

name, exchange, symbol, min_change, min_amount, unit_amount

  • min_change : price precision, ondergrens switch of entrust price
  • min_amount : ondergrens amount of an entrust
  • unit_amount : entrust amount precision, ondergrens switch of entrust amount

To get supported contracts by exchange, use:

To get a certain contract, use:

symbol : exchange/name, for example: binance/btc.usdt

To subscribe contract tick.

async def subscribe_tick(self, contract, on_update=None)

contract : str, contract name. e.g. ltc.btc:xtc.okex

on_update : func, callback function, accept both async and non-async function.

to subscribe a tick stream of contract, on_update will be called merienda fresh tick reach.

async def get_last_tick(self, contract)

contract : str, contract name. e.g. ltc.btc:xtc.okex

to get the last tick of specific contract.

To perform account deeds.

def __init__(self, symbol: str, api_key, api_secret, loop=None, host=None)

Related movie:

symbol : str, symbol

api_key : str, 1token api_key, generated te 1token

api_secret : str, 1token api_secret, generate ter 1token

host : default to

initialize an account for specific symbol with api_key and api_secret

async def get_pending_list(self)

get the list of orders on pending status

async def cancel_use_client_oid(self, oid, *oids)

oid : str, client_oid

visera orders with oid . Support multi oids, use account.cancel_use_client_oid(oid1, oid2, . )

async def cancel_use_exchange_oid(self, oid, *oids)

oid : str, exchange_oid

parasol orders with oid . Support multi oids, use account.cancel_use_exchange_oid(oid1, oid2, . )

async def cancel_all(self)

visera all orders

async def get_info(self, timeout=15)

get account informatie

comeback (informatie, err)

informatie has the following format:

def get_total_amount(self, pos_symbol)

pos_symbol : str, symbol

comeback position of symbol if symbol te position else 0.0

async def place_and_cancel(self, con, price, bs, amount, sleep, options=None)

con : str, contract

price : number, desired price

bs : str, ‘b’ or ‘s’ , ‘b’ for buy, ‘s’ for sell

amount : number, dreamed amount

sleep : int, seconds inbetween place and contrapuerta

place a order and tejadillo it after sleep seconds

async def get_status(self)

async def get_order_use_client_oid(self, oid, *oids) async def get_order_use_exchange_oid(self, oid, *oids)

get order with client_oid or exchange_oid, support multi oids

eg. account.get_order_use_exchange_oid(oid1, oid2, oid3)

always come back a list of orders

async def amend_order_use_client_oid(self, client_oid, price, amount)

async def amend_order_use_exchange_oid(self, exchange_oid, price, amount)

client_oid | exchange_oid : str, oid

price : number, dreamed price

amount : number, dreamed amount

amend specific order with fresh price and amount

async def place_order(self, con, price, bs, amount, client_oid=None, tags=None, options=None)

con : str, contract

price : number, wished price

bs : str, ‘b’|’s’ , to buy or to sell

Related movie:

amount : number, wished amount

client_oid : str(len == 32), client_oid is used to locate orders which will be generated randomly if not provided

tags : dict, tags

Connect your websocket client to wss://

A basic directive is sent ter the following format:

The following guidelines are available without authentication:

  • subscribe-single-tick-verbose subscribe a real-time ticker informatie of a given contract

Leave a Reply

Your email address will not be published. Required fields are marked *