|
6 | 6 | - the eth private key will only be used in the Py SDK to sign a message |
7 | 7 | - the eth private key is not required in order to trade on the platform |
8 | 8 | - the eth private key is not passed to the binary |
9 | | - - copy the output of the script and post it into `create_cancel_order.py` |
| 9 | + - save the output of the script as you'll need to use it on all scripts |
10 | 10 | - the output should look like |
11 | 11 | ``` |
12 | 12 | BASE_URL = 'https://testnet.zklighter.elliot.ai' |
13 | 13 | API_KEY_PRIVATE_KEY = '0xea5d2eca5be67eca056752eaf27b173518b8a5550117c09d2b58c7ea7d306cc4426f913ccf27ab19' |
14 | 14 | ACCOUNT_INDEX = 595 |
15 | 15 | API_KEY_INDEX = 1 |
16 | 16 | ``` |
17 | | -- start trading using |
18 | | - - `create_cancel_order.py` has an example which created an order on testnet & cancels it |
19 | | - - you'll need to set up both your account index, api key index & API Key private key |
| 17 | +## Start trading on testnet |
| 18 | +For each example, you'll need to setup the base url / api_key_private_key / account_index and api_key index using the output of the `setup.py` |
| 19 | + |
| 20 | + - `create_modify_cancel_order.py` |
| 21 | + - creates an ask (sell) order for 0.1 ETH @ $4050 |
| 22 | + - modified the order and increases the size to 0.11 ETH and increases the price to $4100 |
| 23 | + - cancels the order |
| 24 | + - Note: all of these operations use the client order index of the order. You can use the order from the exchange as well |
| 25 | + |
| 26 | + - `create_grouped_ioc_with_attached_sl_tp.py` |
| 27 | + - creates an ask (sell) IoC order for 0.1 ETH |
| 28 | + - along w/ the order, it sets up a Stop Loss (SL) and a Take Profit (TP) order for the whole size of the order |
| 29 | + - the size of the SL/TP will be equal to the executed size of the order |
| 30 | + - the SL/TP orders are canceled when the sign of your position changes |
| 31 | + |
| 32 | + - `create_position_tied_sl_tl.py` |
| 33 | + - creates a bid (buy) Stop Loss (SL) and a Take Profit (TP) to close your short position |
| 34 | + - the size of the orders will be for your whole position (because BaseAmount=0) |
| 35 | + - the orders will grow / shrink as you accumulate more position |
| 36 | + - the SL/TP orders are canceled when the sign of your position changes |
| 37 | + |
| 38 | +### On SL/TP orders |
| 39 | +SL/TP orders need to be configured beyond just setting the trigger price. When the trigger price is set, |
| 40 | +the order will just be executed, like a normal order. This means that a market order, for example, might not have enough slippage! \ |
| 41 | +Let's say that you have a 1 BTC long position, and the current price is $110'000. \ |
| 42 | +You want to set up a take profit at $120'000 |
| 43 | +- order should be an ask (sell) order, to close your position |
| 44 | +- the trigger price should be $120'000 |
| 45 | + |
| 46 | +What about the order type |
20 | 47 |
|
21 | 48 | ## Setup steps for mainnet |
22 | 49 | - deposit money on Lighter to create an account first |
|
0 commit comments