Skip to content
Merged
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 Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ clean-all:
$(call clean_repos)

clone-injective-indexer:
git clone https://github.com/InjectiveLabs/injective-indexer.git -b v1.17.81 --depth 1 --single-branch
git clone https://github.com/InjectiveLabs/injective-indexer.git -b v1.18.3 --depth 1 --single-branch

clone-all: clone-injective-indexer

Expand Down
6 changes: 3 additions & 3 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ inputs:
- git_repo: https://github.com/InjectiveLabs/wasmd
tag: v0.53.3-inj.2
- git_repo: https://github.com/InjectiveLabs/cometbft
tag: v1.0.1-inj.3
tag: v1.0.1-inj.6
- git_repo: https://github.com/InjectiveLabs/cosmos-sdk
tag: v0.50.14-inj.3
tag: v0.50.14-inj.4
# - git_repo: https://github.com/InjectiveLabs/wasmd
# branch: v0.51.x-inj
# subdir: proto
- git_repo: https://github.com/InjectiveLabs/hyperlane-cosmos
tag: v1.0.1-inj
subdir: proto
- git_repo: https://github.com/InjectiveLabs/injective-core
tag: v1.18.0-alpha.3
tag: v1.18.0
subdir: proto
# - git_repo: https://github.com/InjectiveLabs/injective-core
# branch: c-655/add_chainlink_data_streams_oracle
Expand Down
2 changes: 1 addition & 1 deletion examples/chain_client/10_SearchLiquidablePositions.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ async def main() -> None:
adjusted_unit_margin = (adj_margin / quantity) * (-1 if is_long else 1)
maintenance_margin_ratio = client_market.maintenance_margin_ratio * (-1 if is_long else 1)

liquidation_price = (entry_price + adjusted_unit_margin) / (Decimal(1) + maintenance_margin_ratio)
liquidation_price = (entry_price + adjusted_unit_margin) / (Decimal("1") + maintenance_margin_ratio)

should_be_liquidated = (is_long and market_mark_price <= liquidation_price) or (
not is_long and market_mark_price >= liquidation_price
Expand Down
32 changes: 12 additions & 20 deletions examples/chain_client/1_LocalOrderHash.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,23 +67,19 @@ async def main() -> None:
market_id=deriv_market_id,
subaccount_id=subaccount_id,
fee_recipient=fee_recipient,
price=Decimal(10500),
quantity=Decimal(0.01),
margin=composer.calculate_margin(
quantity=Decimal(0.01), price=Decimal(10500), leverage=Decimal(2), is_reduce_only=False
),
price=Decimal("10500"),
quantity=Decimal("0.01"),
margin=Decimal("52.5"),
order_type="BUY",
cid=str(uuid.uuid4()),
),
composer.derivative_order(
market_id=deriv_market_id,
subaccount_id=subaccount_id,
fee_recipient=fee_recipient,
price=Decimal(65111),
quantity=Decimal(0.01),
margin=composer.calculate_margin(
quantity=Decimal(0.01), price=Decimal(65111), leverage=Decimal(2), is_reduce_only=False
),
price=Decimal("65111"),
quantity=Decimal("0.01"),
margin=Decimal("325.555"),
order_type="SELL",
cid=str(uuid.uuid4()),
),
Expand Down Expand Up @@ -204,23 +200,19 @@ async def main() -> None:
market_id=deriv_market_id,
subaccount_id=subaccount_id_2,
fee_recipient=fee_recipient,
price=Decimal(25111),
quantity=Decimal(0.01),
margin=composer.calculate_margin(
quantity=Decimal(0.01), price=Decimal(25111), leverage=Decimal("1.5"), is_reduce_only=False
),
price=Decimal("25111"),
quantity=Decimal("0.01"),
margin=Decimal("167.406666666666666667"),
order_type="BUY",
cid=str(uuid.uuid4()),
),
composer.derivative_order(
market_id=deriv_market_id,
subaccount_id=subaccount_id_2,
fee_recipient=fee_recipient,
price=Decimal(65111),
quantity=Decimal(0.01),
margin=composer.calculate_margin(
quantity=Decimal(0.01), price=Decimal(25111), leverage=Decimal(2), is_reduce_only=False
),
price=Decimal("65111"),
quantity=Decimal("0.01"),
margin=Decimal("125.555"),
order_type="SELL",
cid=str(uuid.uuid4()),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,9 @@ async def main() -> None:
market_id=market_id,
subaccount_id=subaccount_id,
fee_recipient=fee_recipient,
price=Decimal(50000),
quantity=Decimal(0.1),
margin=composer.calculate_margin(
quantity=Decimal(0.1), price=Decimal(50000), leverage=Decimal(1), is_reduce_only=False
),
price=Decimal("50000"),
quantity=Decimal("0.1"),
margin=Decimal("5000"),
order_type="SELL",
cid=str(uuid.uuid4()),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,9 @@ async def main() -> None:
market_id=market_id,
subaccount_id=subaccount_id,
fee_recipient=fee_recipient,
price=Decimal(50000),
quantity=Decimal(0.1),
margin=composer.calculate_margin(
quantity=Decimal(0.1), price=Decimal(50000), leverage=Decimal(1), is_reduce_only=False
),
price=Decimal("50000"),
quantity=Decimal("0.1"),
margin=Decimal("5000"),
order_type="BUY",
cid=str(uuid.uuid4()),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,8 @@ async def main() -> None:
subaccount_id=subaccount_id,
fee_recipient=fee_recipient,
price=Decimal("0.5"),
quantity=Decimal(1),
margin=composer.calculate_margin(
quantity=Decimal(1), price=Decimal("0.5"), leverage=Decimal(1), is_reduce_only=False
),
quantity=Decimal("1"),
margin=Decimal("0.5"),
cid=str(uuid.uuid4()),
)

Expand Down
8 changes: 3 additions & 5 deletions examples/chain_client/exchange/19_MsgLiquidatePosition.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,9 @@ async def main() -> None:
market_id=market_id,
subaccount_id=subaccount_id,
fee_recipient=fee_recipient,
price=Decimal(39.01), # This should be the liquidation price
quantity=Decimal(0.147),
margin=composer.calculate_margin(
quantity=Decimal(0.147), price=Decimal(39.01), leverage=Decimal(1), is_reduce_only=False
),
price=Decimal("39.01"), # This should be the liquidation price
quantity=Decimal("0.147"),
margin=Decimal("5.73447"),
order_type="SELL",
cid=cid,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async def main() -> None:
market_id=market_id,
source_subaccount_id=subaccount_id,
destination_subaccount_id=subaccount_id,
amount=Decimal(2),
amount=Decimal("2"),
)

# broadcast the transaction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ async def main() -> None:
# prepare trade info
market_id = "0xfafec40a7b93331c1fc89c23f66d11fbb48f38dfdd78f7f4fc4031fad90f6896"
status = "Demolished"
settlement_price = Decimal(1)
settlement_price = Decimal("1")
expiration_timestamp = 1685460582
settlement_timestamp = 1690730982

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ async def main() -> None:
market_id=market_id,
source_subaccount_id=subaccount_id,
destination_subaccount_id=subaccount_id,
amount=Decimal(2),
amount=Decimal("2"),
)

# broadcast the transaction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,9 @@ async def main() -> None:
market_id=market_id,
subaccount_id=subaccount_id,
fee_recipient=fee_recipient,
price=Decimal(50000),
quantity=Decimal(0.1),
margin=composer.calculate_margin(
quantity=Decimal(0.1), price=Decimal(50000), leverage=Decimal(1), is_reduce_only=False
),
price=Decimal("50000"),
quantity=Decimal("0.1"),
margin=Decimal("5000"),
order_type="SELL",
cid=str(uuid.uuid4()),
expiration_block=latest_height + 10,
Expand Down
24 changes: 9 additions & 15 deletions examples/chain_client/exchange/9_MsgBatchUpdateOrders.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,23 +82,19 @@ async def main() -> None:
market_id=derivative_market_id_create,
subaccount_id=subaccount_id,
fee_recipient=fee_recipient,
price=Decimal(25000),
quantity=Decimal(0.1),
margin=composer.calculate_margin(
quantity=Decimal(0.1), price=Decimal(25000), leverage=Decimal(1), is_reduce_only=False
),
price=Decimal("25000"),
quantity=Decimal("0.1"),
margin=Decimal("2500"),
order_type="BUY",
cid=str(uuid.uuid4()),
),
composer.derivative_order(
market_id=derivative_market_id_create,
subaccount_id=subaccount_id,
fee_recipient=fee_recipient,
price=Decimal(50000),
quantity=Decimal(0.01),
margin=composer.calculate_margin(
quantity=Decimal(0.01), price=Decimal(50000), leverage=Decimal(1), is_reduce_only=False
),
price=Decimal("50000"),
quantity=Decimal("0.01"),
margin=Decimal("500"),
order_type="SELL",
cid=str(uuid.uuid4()),
),
Expand All @@ -109,11 +105,9 @@ async def main() -> None:
market_id=derivative_market_id_create,
subaccount_id=subaccount_id,
fee_recipient=fee_recipient,
price=Decimal(25100),
quantity=Decimal(0.1),
margin=composer.calculate_margin(
quantity=Decimal(0.1), price=Decimal(25100), leverage=Decimal(1), is_reduce_only=False
),
price=Decimal("25100"),
quantity=Decimal("0.1"),
margin=Decimal("2510"),
order_type="BUY",
cid=str(uuid.uuid4()),
),
Expand Down
Loading