mirror of
https://github.com/aljazceru/bitfinex-api-py.git
synced 2025-12-19 14:54:21 +01:00
Orders: add meta field and support for aff_code
This commit is contained in:
committed by
Jacob Plaster
parent
821f8831b9
commit
39e79da9a1
@@ -491,8 +491,8 @@ class BfxRest:
|
||||
async def submit_order(self, symbol, price, amount, market_type=Order.Type.LIMIT,
|
||||
hidden=False, price_trailing=None, price_aux_limit=None,
|
||||
oco_stop_price=None, close=False, reduce_only=False,
|
||||
post_only=False, oco=False, time_in_force=None, leverage=None,
|
||||
gid=None):
|
||||
post_only=False, oco=False, aff_code=None, time_in_force=None,
|
||||
leverage=None, gid=None):
|
||||
"""
|
||||
Submit a new order
|
||||
|
||||
@@ -514,6 +514,7 @@ class BfxRest:
|
||||
match with a pre-existing order
|
||||
@param oco: cancels other order option allows you to place a pair of orders stipulating
|
||||
that if one order is executed fully or partially, then the other is automatically canceled
|
||||
@param aff_code: bitfinex affiliate code
|
||||
@param time_in_force: datetime for automatic order cancellation ie. 2020-01-01 10:45:23
|
||||
@param leverage: the amount of leverage to apply to the order as an integer
|
||||
"""
|
||||
@@ -524,6 +525,7 @@ class BfxRest:
|
||||
"symbol": symbol,
|
||||
"amount": str(amount),
|
||||
"price": str(price),
|
||||
"meta": {}
|
||||
}
|
||||
# calculate and add flags
|
||||
flags = calculate_order_flags(hidden, close, reduce_only, post_only, oco)
|
||||
@@ -541,6 +543,8 @@ class BfxRest:
|
||||
payload['gid'] = gid
|
||||
if leverage is not None:
|
||||
payload['lev'] = str(leverage)
|
||||
if aff_code is not None:
|
||||
payload['meta']['aff_code'] = str(aff_code)
|
||||
endpoint = "auth/w/order/submit"
|
||||
raw_notification = await self.post(endpoint, payload)
|
||||
return Notification.from_raw_order(raw_notification)
|
||||
|
||||
Reference in New Issue
Block a user