Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Python SDK for Lighter

## Requirements.
## Requirements

Python 3.8+

Expand Down
6 changes: 3 additions & 3 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

- `create_grouped_ioc_with_attached_sl_tp.py`
- creates an ask (sell) IoC order for 0.1 ETH
- along w/ the order, it sets up a Stop Loss (SL) and a Take Profit (TP) order for the whole size of the order
- along with the order, it sets up a Stop Loss (SL) and a Take Profit (TP) order for the whole size of the order
- the size of the SL/TP will be equal to the executed size of the order
- the SL/TP orders are canceled when the sign of your position changes

Expand Down Expand Up @@ -62,14 +62,14 @@ What about the order types? Just as normal orders, SL/TP orders trigger an order
- `send_batch_tx_http.py`
- sends multiple orders in a single HTTP request
- `send_batch_tx_ws.py`
- sends multiple orders in a single WS request`
- sends multiple orders in a single WS request

Batch TXs will be executed back to back, without the possibility of other TXs interfering.

## Spot Trading
To trade spot markets, you need to have spot USDC. USDC used in your perpetual account will be used as collateral for your cross-positions.
USDC deposited in the spot account can only be used to buy spot assets.
To transfer USDC between spot <> perp balance, or vice verse, check out
To transfer USDC between spot <> perp balance, or vice versa, check out
- `spot_self_transfer_perp_spot.py`
- `spot_self_transfer_spot_perp.py`

Expand Down
2 changes: 1 addition & 1 deletion lighter/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class ApiClient:
PRIMITIVE_TYPES = (float, bool, bytes, str, int)
NATIVE_TYPES_MAPPING = {
'int': int,
'long': int, # TODO remove as only py3 is supported?
'long': int, # TODO remove as only py3 is supported?
'float': float,
'str': str,
'bool': bool,
Expand Down
2 changes: 1 addition & 1 deletion lighter/nonce_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


def get_nonce_from_api(client: ApiClient, account_index: int, api_key: int) -> int:
# uses request to avoid async initialization
# uses requests to avoid async initialization
req = requests.get(
client.configuration.host + "/api/v1/nextNonce",
params={"account_index": account_index, "api_key_index": api_key},
Expand Down
2 changes: 1 addition & 1 deletion lighter/paper_client/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class PaperHealthStatus(IntEnum):
# in real Lighter, accounts pass through TAV < MMR and TAV < COMR states,
# but the paper sim collapses them. Liquidation runs atomically with every
# mark update, so any position whose mark crosses liquidation_price is wiped
# in the same tick.
# in the same tick.
BANKRUPTCY = 4

def utc_now() -> datetime:
Expand Down