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,36 @@
|
||||
- [Bybit Positions](./examples/py/)
|
||||
|
||||
|
||||
```python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
import ccxt # noqa: E402
|
||||
|
||||
from pprint import pprint
|
||||
|
||||
print('CCXT Version:', ccxt.__version__)
|
||||
|
||||
exchange = ccxt.bybit ({
|
||||
'apiKey': 'YOUR_API_KEY',
|
||||
'secret': 'YOUR_SECRET',
|
||||
})
|
||||
|
||||
markets = exchange.load_markets() # https://github.com/ccxt/ccxt/wiki/Manual#loading-markets
|
||||
|
||||
exchange.verbose = True # uncomment for debugging
|
||||
symbol = 'BTC/USDT:USDT' # https://github.com/ccxt/ccxt/wiki/Manual#contract-naming-conventions
|
||||
market = exchange.market(symbol)
|
||||
params = {'subType':'linear' if market['linear'] else 'inverse'}
|
||||
linear_positions = exchange.fetch_positions([ symbol ], params)
|
||||
pprint(linear_positions)
|
||||
symbol = 'BTC/USD:BTC'
|
||||
market = exchange.market(symbol)
|
||||
params = {'subType':'linear' if market['linear'] else 'inverse'}
|
||||
inverse_positions = exchange.fetch_positions([ symbol ], params)
|
||||
pprint(inverse_positions)
|
||||
|
||||
```
|
||||
Reference in New Issue
Block a user