Skip to content

Conversation

@itsdeka
Copy link
Contributor

@itsdeka itsdeka commented Mar 29, 2021

Description:

Added 'ids' parameter to get_order_history()

Breaking changes:

  • [ ]

New features:

  • [X]

Fixes:

  • [ ]

PR status:

  • Version bumped
  • Change-log updated

@itsdeka
Copy link
Contributor Author

itsdeka commented Apr 19, 2021

Please @robertkowalski merge this when possible

@itsdeka itsdeka mentioned this pull request May 21, 2021
4 tasks
@itsdeka
Copy link
Contributor Author

itsdeka commented May 24, 2021

Code example

from bfxapi import Client
import asyncio
from datetime import datetime

bfx = Client(
    API_KEY='',
    API_SECRET='',
    logLevel='DEBUG'
)

async def create_order():
  req = await bfx.rest.submit_order(amount=1, price=20000, symbol='tBTCUSD', post_only=True)
  p_order = req.notify_info[0]
  history = await bfx.rest.get_order_history(symbol='tBTCUSD', start=None, end=None, limit=5, sort=-1, ids=[p_order.id])

  print(
    f"Datetime {datetime.fromtimestamp(p_order.mts_create / 1000)} | Order {p_order.id} | Amount {p_order.amount} | Price {p_order.price}")

  print('...')

  for order in history:
    print (f"Datetime {datetime.fromtimestamp(order.mts_create / 1000)} | Order {order.id} | Amount {order.amount} | Price {order.price}")

async def run():
  await create_order()

t = asyncio.ensure_future(run())
asyncio.get_event_loop().run_until_complete(t)

Example output

Datetime 2021-05-24 13:54:22.048000 | Order 1233336217 | Amount 1 | Price 20000
...
Datetime 2021-05-24 13:54:22 | Order 1233336217 | Amount 1 | Price 20000

@robertkowalski robertkowalski merged commit 4a8d3e4 into bitfinexcom:master May 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants