mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-11 09:18:08 +00:00
commit
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
- [Binance Poll Positions](./examples/py/)
|
||||
|
||||
|
||||
```python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
import ccxt # noqa: E402
|
||||
|
||||
|
||||
print('CCXT Version:', ccxt.__version__)
|
||||
|
||||
|
||||
exchange = ccxt.binanceusdm({
|
||||
'apiKey': 'YOUR_API_KEY',
|
||||
'secret': 'YOUR_SECRET',
|
||||
})
|
||||
markets = exchange.load_markets()
|
||||
|
||||
# exchange.verbose = True # uncomment for debugging purposes if necessary
|
||||
|
||||
while True:
|
||||
try:
|
||||
positions = exchange.fetch_positions ()
|
||||
print(exchange.iso8601(exchange.milliseconds()), len(positions), 'positions')
|
||||
print([ [position['symbol'], position['contracts']] for position in positions ])
|
||||
except Exception as e:
|
||||
print(type(e).__name__, str(e))
|
||||
|
||||
|
||||
```
|
||||
Reference in New Issue
Block a user