examples: adds atuh funding functions

This commit is contained in:
Jacob Plaster
2018-12-05 15:44:33 +00:00
parent d4c2942f22
commit 5a7ebb3874

View File

@@ -16,6 +16,9 @@ bfx = Client(
rest_host='https://test.bitfinex.com/v2'
)
now = int(round(time.time() * 1000))
then = now - (1000 * 60 * 60 * 24 * 10) # 10 days ago
async def log_wallets():
wallets = await bfx.rest.get_wallets()
print ("Wallets:")
@@ -27,9 +30,6 @@ async def log_active_orders():
[ print (o) for o in orders ]
async def log_orders_history():
now = int(round(time.time() * 1000))
then = now - (1000 * 60 * 60 * 24 * 10) # 10 days ago
orders = await bfx.rest.get_order_history('tBTCUSD', 0, then)
print ("Orders:")
[ print (o) for o in orders ]
@@ -40,19 +40,57 @@ async def log_active_positions():
[ print (p) for p in positions ]
async def log_trades():
now = int(round(time.time() * 1000))
then = now - (1000 * 60 * 60 * 24 * 10) # 10 days ago
trades = await bfx.rest.get_trades('tBTCUSD', 0, then)
print ("Trades")
print ("Trades:")
[ print (t) for t in trades]
async def log_order_trades():
order_id = 1151353463
trades = await bfx.rest.get_order_trades('tBTCUSD', order_id)
print ("Trade orders:")
[ print (t) for t in trades]
async def log_funding_offers():
offers = await bfx.rest.get_funding_offers('tBTCUSD')
print ("Offers:")
[ print (o) for o in offers]
async def log_funding_offer_history():
offers = await bfx.rest.get_funding_offer_history('tBTCUSD', 0, then)
print ("Offers history:")
[ print (o) for o in offers]
async def log_funding_loans():
loans = await bfx.rest.get_funding_loans('tBTCUSD')
print ("Funding loans:")
[ print (l) for l in loans ]
async def log_funding_loans_history():
loans = await bfx.rest.get_funding_loan_history('tBTCUSD', 0, then)
print ("Funding loan history:")
[ print (l) for l in loans ]
async def log_funding_credits():
credits = await bfx.rest.get_funding_credits('tBTCUSD')
print ("Funding credits:")
[ print (c) for c in credits ]
async def log_funding_credits_history():
credit = await bfx.rest.get_funding_credit_history('tBTCUSD', 0, then)
print ("Funding credit history:")
[ print (c) for c in credit ]
async def run():
await log_wallets()
await log_active_orders()
await log_orders_history()
await log_active_positions()
await log_trades()
await log_order_trades()
await log_funding_offers()
await log_funding_offer_history()
await log_funding_credits()
await log_funding_credits_history()
t = asyncio.ensure_future(run())