mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-11 01:08:07 +00:00
commit
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
- [Margin Leverage Order Kraken](./examples/py/)
|
||||
|
||||
|
||||
```python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
import ccxt # noqa: E402
|
||||
|
||||
|
||||
kraken = ccxt.kraken({
|
||||
'apiKey': 'YOUR_API_KEY',
|
||||
'secret': 'YOUR_SECRET',
|
||||
})
|
||||
|
||||
kraken.load_markets()
|
||||
|
||||
for symbol in kraken.symbols:
|
||||
print(
|
||||
symbol,
|
||||
'Available leverage levels',
|
||||
'Buy:', kraken.markets[symbol]['info']['leverage_buy'],
|
||||
'Sell:', kraken.markets[symbol]['info']['leverage_sell']
|
||||
)
|
||||
|
||||
# THIS IS A KRAKEN-SPECIFIC EXAMPLE.
|
||||
# THE LEVERAGE WILL NOT WORK WITH OTHER EXCHANGES THE SAME WAY.
|
||||
# USE IMPLICIT METHODS FOR MARGIN/LEVERAGED ORDERS WITH OTHER EXCHANGES:
|
||||
# https://github.com/ccxt/ccxt/wiki/Manual#implicit-api-methods
|
||||
|
||||
# with create_order all params (including the price=None) are needed!
|
||||
# the extra param should be "leverage", not "leverage_sell" nor "leverage-sell"
|
||||
kraken.create_order('BTC/USD', 'market', 'sell', 0.01, None, {'leverage': 3})
|
||||
|
||||
# or use a shorthand create_market_sell_order (no "price" param)
|
||||
kraken.create_market_sell_order('BTC/USD', 0.01, {'leverage': 3})
|
||||
|
||||
```
|
||||
Reference in New Issue
Block a user