Git Product home page Git Product logo

uxapi's Introduction

UXAPI - Unified eXchange API

uxapi's People

Contributors

lattesir avatar mingrui avatar

Stargazers

 avatar Solo avatar brizz avatar nilux avatar  avatar  avatar

Watchers

 avatar James Cloos avatar  avatar  avatar

Forkers

mingrui yurenji

uxapi's Issues

huobi parse order 中,fee currency

  1. 现货、杠杆 手续费币种取决于 买卖方向
  2. futures/swap/swap.usdt 手续费字段可以从 fee_asset 字段中提取

def parse_order(self, order, market=None):
timestamp = self.safe_integer(order, 'created_at')
status = self.safe_string(order, 'status')
status = self.parse_order_status(status)
currency = self.safe_string(order, 'symbol')
type = market['type'] if market else self.options['defaultType']
if type == 'futures':
contract_type = self.safe_string(order, 'contract_type')
expiration = self.expirations[contract_type]
symbol = f'{currency}_{expiration}'
else:
symbol = self.safe_string(order, 'contract_code')
side = self.safe_string(order, 'direction')
price = self.safe_float(order, 'price')
average = self.safe_float(order, 'trade_avg_price')
amount = self.safe_float(order, 'volume')
filled = self.safe_float(order, 'trade_volume')
remaining = None
if filled is not None and amount is not None:
remaining = amount - filled
fee = None
fee_cost = self.safe_float(order, 'fee')
if fee_cost is not None:
fee = {
'cost': fee_cost,
'currency': currency,
}

UXTopic 传入下方 handlers

okex.futures.public_trades:
    exchange_id: okex
    market_type: futures
    datatype: trade
    extrainfo: BTC/USD.CQ

hadlers 经常需要用到 UXTopics 内的信息,是否可以直接把 UXTopic 提供给 handlers 使用?

现在的一个 work around 是把 topic 当作 handlers parameter 传入:

pipeline = Pipeline([HuobiParseOrderBookDelta(topic), OrderBookDeltaToRedisStream(redis_client, 1000)])

okex spot 获取 order 时,instrument_id 为必传参数

def fetch_order(self, id, symbol=None, params={}):
if symbol is None:
raise ArgumentsRequired(self.id + ' fetchOrder requires a symbol argument')
self.load_markets()
market = self.market(symbol)
defaultType = self.safe_string_2(self.options, 'fetchOrder', 'defaultType', market['type'])
type = self.safe_string(params, 'type', defaultType)
if type is None:
raise ArgumentsRequired(self.id + " fetchOrder requires a type parameter(one of 'spot', 'margin', 'futures', 'swap').")
method = type + 'GetOrders'
if market['futures'] or market['swap']:
method += 'InstrumentId'
request = {
'instrument_id': market['id'],
}
elif market['option']:
method += 'Underlying'
request = {
'underlying': market['info']['underlying'],
}
else:
request = {}

ccxt 已更新:

https://github.com/ccxt/ccxt/blob/0877a5ddbaa4b873af959e3da580d0e323a6270b/python/ccxt/okex.py#L2120-L2124

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.