From f264a80d9663affbd4bcb28994bbcf426a6b546d Mon Sep 17 00:00:00 2001 From: Nikolai Date: Tue, 30 Jul 2019 13:09:46 +0300 Subject: [PATCH] Update README.md --- README.md | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 5056c17..8e84ede 100644 --- a/README.md +++ b/README.md @@ -19,10 +19,7 @@ Backtrader Python client located here: [Python Backtrader - Metaquotes MQL5 ](ht In development: * Add error handling to docs -* Trades info -* Experation * Devitation -* Netting/hedging mode switch * Stop limit orders ## Installation @@ -244,7 +241,7 @@ History data reply example: Buy market order. ``` python -rep = api.construct_and_send(action="TRADE", actionType="ORDER_TYPE_BUY", symbol="EURUSD", "volume": 0.1, "stoploss": 1.1, "takeprofit": 1.3) +rep = api.construct_and_send(action="TRADE", actionType="ORDER_TYPE_BUY", symbol="EURUSD", "volume"=0.1, "stoploss"=1.1, "takeprofit"=1.3) print(rep) ``` @@ -254,7 +251,13 @@ Sell limit order. Remember to switch SL/TP depending on BUY/SELL, or you will ge - SELL: SL > price > TP ``` python -rep = api.construct_and_send(action="TRADE", actionType="ORDER_TYPE_SELL_LIMIT", symbol="EURUSD", "volume": 0.1, "price": 1.2, "stoploss": 1.3, "takeprofit": 1.1) +rep = api.construct_and_send(action="TRADE", actionType="ORDER_TYPE_SELL_LIMIT", symbol="EURUSD", "volume"=0.1, "price"=1.2, "stoploss"=1.3, "takeprofit"=1.1) +print(rep) +``` +All pending orders are set to `Good till cancel` by default. If you want to set an expiration date, pass the date in timestamp format to `expiration` param. + +``` python +rep = api.construct_and_send(action="TRADE", actionType="ORDER_TYPE_SELL_LIMIT", symbol="EURUSD", "volume"=0.1, "price"=1.2, "expiration"=1560782460) print(rep) ``` ## Live data and streaming events @@ -290,20 +293,19 @@ def _t_streaming_events(): print(reply) -for _ in range(3): - t = threading.Thread(target=_t_livedata, daemon=True) - t.start() -for _ in range(3): - t = threading.Thread(target=_t_streaming_events, daemon=True) - t.start() +t = threading.Thread(target=_t_livedata, daemon=True) +t.start() + +t = threading.Thread(target=_t_streaming_events, daemon=True) +t.start() while True: pass ``` -There are only two variants of `Live socket` data. When everything is ok, the script sends candle data on close: +There are only two variants of `Live socket` data. When everything is ok, the script sends data on candle close: ``` {"status":"CONNECTED","data":[1560780120,1.12186,1.12194,1.12186,1.12191,15.00000]}