Skip to content

Commit

Permalink
fixing python sdk (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
tinystarinagalaxy authored Sep 6, 2023
1 parent fedc253 commit 5625768
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ you can build the solana-trader-proto/python directory using these commands
$ python3 -m twine upload --repository pypi dist/*
and install the package locally now
$ pip install dist/bxsolana-trader-proto-0.0.31.tar.gz
$ pip install dist/bxsolana-trader-proto-0.0.42.tar.gz
now you can update the depdendency in solana-trader-client-python
update the version of bxsolana-trader-proto in setup.cfg
Expand Down
16 changes: 9 additions & 7 deletions bxsolana/examples/request_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from bxsolana_trader_proto.common import PerpCollateralType
from bxsolana_trader_proto.common import PerpCollateralToken

from .constants import SIDE_ASK
from .. import provider


Expand Down Expand Up @@ -243,9 +242,10 @@ async def do_requests(
owner_address=public_key,
payer_address=public_key,
market="SOLUSDC",
side=SIDE_ASK,
side="ASK",
amount=0.1,
price=150_000,
type="limit",
# optional, but much faster if known
open_orders_address=open_orders,
# optional, for identification
Expand All @@ -261,7 +261,7 @@ async def do_requests(
await api.post_cancel_order_v2(
post_cancel_order_request_v2=proto.PostCancelOrderRequestV2(
order_id=order_id,
side=proto.Side.S_ASK,
side="ASK",
market_address="SOLUSDC",
owner_address=public_key,
open_orders_address=open_orders,
Expand Down Expand Up @@ -304,7 +304,8 @@ async def do_requests(
owner_address=public_key,
payer_address=public_key,
market="SOLUSDC",
side=SIDE_ASK,
side="ASK",
type="limit",
amount=0.1,
price=150_000,
# optional, but much faster if known
Expand All @@ -324,7 +325,7 @@ async def do_requests(
owner_address=public_key,
payer_address=public_key,
market="SOLUSDC",
side=SIDE_ASK,
side="ASK",
amount=0.1,
price=150_000,
# optional, but much faster if known
Expand Down Expand Up @@ -665,7 +666,7 @@ async def do_requests(
post_drift_margin_order_request=proto.PostDriftMarginOrderRequest(
owner_address=public_key,
market="SOL",
position_side="LONG",
position_side="BUY",
slippage=10,
type="MARKET", # or Limit
amount=10,
Expand Down Expand Up @@ -759,6 +760,7 @@ async def do_requests(
owner_address=public_key,
contract="SOL_PERP",
position_side="LONG",
post_only="none",
slippage=0,
type="LIMIT",
amount=0,
Expand Down Expand Up @@ -970,7 +972,7 @@ async def do_requests(
token=PerpCollateralToken.PCTK_SOL,
type=PerpCollateralType.PCT_TRANSFER,
to_account_address=(
"AbnwAQGrYnvktT4ihhX5np8RbgtfXJfPwpgMJnCFa4MT"
"9UnwdvTf5EfGeLyLrF4GZDUs7LKRUeJQzW7qsDVGQ8sS"
),
)
)
Expand Down
4 changes: 2 additions & 2 deletions bxsolana/provider/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,15 +632,15 @@ async def get_open_orders_v2(
timeout: Optional[float] = None,
deadline: Optional["Deadline"] = None,
metadata: Optional["MetadataLike"] = None,
) -> proto.GetOpenOrdersResponse:
) -> proto.GetOpenOrdersResponseV2:
async with self._session.get(
f"{self._endpoint_v2}/openbook/open-orders/{get_open_orders_request_v2.market}"
f"?address={get_open_orders_request_v2.address}"
f"&openOrdersAddress={get_open_orders_request_v2.open_orders_address}"
f"&orderID={get_open_orders_request_v2.order_id}"
f"&clientOrderID={get_open_orders_request_v2.client_order_id}"
) as res:
return await map_response(res, proto.GetOpenOrdersResponse())
return await map_response(res, proto.GetOpenOrdersResponseV2())

async def get_unsettled_v2(
self,
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ install_requires =
solana==0.29.1
solders==0.14.4
bx-jsonrpc-py==0.2.0
bxsolana-trader-proto==0.0.41
bxsolana-trader-proto==0.0.42

0 comments on commit 5625768

Please sign in to comment.