Mizar
Search…
DCA Bot SDK
Install the Mizar client and follow the instruction below.

Open Position

1
from mizar import Mizar
2
3
mizar_client = Mizar()
4
5
mizar_client.dca_bot_open_position(
6
bot_id=1,
7
base_asset="BTC",
8
quote_asset="USDT",
9
)
10
Copied!
It is allowed to override the take profit and stop loss of the bot for
1
mizar_client.dca_bot_open_position(
2
bot_id=1,
3
base_asset="BTC",
4
quote_asset="USDT",
5
take_profit=0.05
6
stop_loss=0.10
7
)
Copied!
Expected response
1
{'detail':
2
'Request with action open-position has been successfully submitted to bot 1 that has 1 subscriptions.'}
Copied!

Close Position

1
mizar_client.dca_bot_close_position(
2
bot_id=1,
3
base_asset="BTC",
4
quote_asset="USDT",
5
)
Copied!
Expected response
1
{'detail':
2
'Request with action close-position has been successfully submitted to bot 1 that has 1 subscriptions.'}
Copied!

Shift Safety Orders

1
mizar_client.dca_bot_shift_safety_orders(
2
bot_id=1,
3
base_asset="BTC",
4
quote_asset="USDT",
5
safety_orders_start_price=45000
6
)
Copied!
Expected response
1
{'detail':
2
'Request with action shift-safety-orders has been successfully submitted to bot 1 that has 1 subscriptions.'}
Copied!

Close All Positions

1
mizar_client.dca_bot_close_positions(
2
bot_id=1,
3
)
Copied!
Expected response
1
{'detail':
2
'Request with action close-all-positions has been successfully submitted to bot 1 that has 1 subscriptions.'}
Copied!

Stop Bot and Close all positions

1
mizar_client.dca_bot_stop_and_close_positions(
2
bot_id=1,
3
)
Copied!
Expected response
1
{'detail':
2
'Request with action stop-bot-and-close-all-positions has been successfully submitted to bot 1 that has 1 subscriptions.'}
Copied!

Get Open Positions

1
mizar_client.get_dca_bot_position(
2
bot_id=1,
3
base_asset="BTC",
4
quote_asset="USDT"
5
)
Copied!
Expected response
1
{'data': {'symbol': 'BTCUSDT',
2
'start_condition_datetime': '2021-08-31T17:21:02.953815',
3
'take_profit_type': 'total',
4
'take_profit_pct': 0.01,
5
'stop_loss_pct': None,
6
'safety_order_deviation_pct': 0.015,
7
'safety_order_step_scale': 1.05,
8
'safety_order_quote_size': 150.0,
9
'safety_order_volume_scale': 1.05,
10
'max_num_safety_order': 5,
11
'side': 'buy',
12
'base_orders': [{'id': '30331250182',
13
'status': 'canceled',
14
'timestamp': 1630430469415,
15
'price': 47415.4,
16
'filled': 0.0,
17
'remaining': 0.005},
18
{'id': '30331253419',
19
'status': 'canceled',
20
'timestamp': 1630430476596,
21
'price': 47418.5,
22
'filled': 0.0,
23
'remaining': 0.005},
24
{'id': '30331257401',
25
'status': 'canceled',
26
'timestamp': 1630430485760,
27
'price': 47418.86,
28
'filled': 0.0,
29
'remaining': 0.005},
30
{'id': '30331263515',
31
'status': 'closed',
32
'timestamp': 1630430486088,
33
'price': 47423.37,
34
'filled': 0.005,
35
'remaining': 0.0}],
36
'active_safety_orders': [{'id': '30331268368',
37
'status': 'open',
38
'timestamp': 1630430492830,
39
'price': 46712.02,
40
'filled': 0.0,
41
'remaining': 0.003}],
42
'take_profit_order': {'id': '30331267657',
43
'status': 'open',
44
'timestamp': 1630430491891,
45
'price': 47897.6,
46
'filled': 0.0,
47
'remaining': 0.005},
48
'inactive_safety_orders': [],
49
'inactive_take_profit_orders': []}}
50
Copied!

Get Safety Orders

1
mizar_client.get_dca_bot_safety_orders(
2
bot_id=1,
3
base_asset="BTC",
4
quote_asset="USDT"
5
)
Copied!
Expected response
1
{'data': [{'id': '30331268368',
2
'status': 'open',
3
'timestamp': 1630430492830,
4
'price': 46712.02,
5
'filled': 0.0,
6
'remaining': 0.003}]}
Copied!

Get Active Safety Orders

1
mizar_client.get_dca_bot_active_safety_orders(
2
bot_id=1,
3
base_asset="BTC",
4
quote_asset="USDT"
5
)
Copied!
Expected response
1
{'data': [{'id': '30331268368',
2
'status': 'open',
3
'timestamp': 1630430492830,
4
'price': 46712.02,
5
'filled': 0.0,
6
'remaining': 0.003}]}
Copied!

Get Inactive Safety Orders

1
mizar_client.get_dca_bot_inactive_safety_orders(
2
bot_id=1,
3
base_asset="BTC",
4
quote_asset="USDT"
5
)
Copied!
Expected response
1
{'data': [{'id': '30331268368',
2
'status': 'canceled',
3
'timestamp': 1630430658612,
4
'price': 46712.02,
5
'filled': 0.0,
6
'remaining': 0.003}]}
Copied!

Get Take Profit Orders

1
mizar_client.get_dca_bot_take_profit_orders(
2
bot_id=1,
3
base_asset="BTC",
4
quote_asset="USDT"
5
)
Copied!
Expected response
1
{'data': [{'id': '30331268368',
2
'status': 'canceled',
3
'timestamp': 1630430658612,
4
'price': 46712.02,
5
'filled': 0.0,
6
'remaining': 0.003}]}
Copied!
Last modified 1mo ago