mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-09 16:28:06 +00:00
46 lines
738 B
Markdown
46 lines
738 B
Markdown
- [Phemex Create Stop Order](./examples/py/)
|
|
|
|
|
|
```python
|
|
# -*- coding: utf-8 -*-
|
|
|
|
import os
|
|
import sys
|
|
|
|
|
|
import ccxt # noqa: E402
|
|
|
|
exchange = ccxt.phemex({
|
|
'apiKey': 'YOUR_API_KEY',
|
|
'secret': 'YOUR_SECRET',
|
|
})
|
|
|
|
# exchange.set_sandbox_mode(True)
|
|
|
|
# Example 1: Creating stop-market order
|
|
symbol = 'LTC/USDT'
|
|
type = 'market'
|
|
side = 'buy'
|
|
amount = 0.5
|
|
|
|
params = {
|
|
'stopPrice': 50,
|
|
}
|
|
|
|
stop_market = exchange.create_order(symbol, type, side, amount, None, params)
|
|
print(stop_market)
|
|
|
|
# Example 2: Create stop-limit order
|
|
symbol = 'LTC/USDT'
|
|
type = 'limit'
|
|
side = 'buy'
|
|
amount = 0.5
|
|
price = 70
|
|
|
|
params = {
|
|
'stopPrice': 50,
|
|
}
|
|
|
|
stop_limit = exchange.create_order(symbol, type, side, amount, price, params)
|
|
print(stop_limit)
|
|
``` |