From 5625768bf68ae858e212d3a041398f783b00ec20 Mon Sep 17 00:00:00 2001 From: tinystarinagalaxy <110410938+tinystarinagalaxy@users.noreply.github.com> Date: Wed, 6 Sep 2023 14:33:05 -0400 Subject: [PATCH] fixing python sdk (#86) --- README.md | 2 +- bxsolana/examples/request_utils.py | 16 +++++++++------- bxsolana/provider/http.py | 4 ++-- setup.cfg | 2 +- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index da298a5..9418855 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/bxsolana/examples/request_utils.py b/bxsolana/examples/request_utils.py index e024be7..b1bdc26 100644 --- a/bxsolana/examples/request_utils.py +++ b/bxsolana/examples/request_utils.py @@ -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 @@ -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 @@ -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, @@ -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 @@ -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 @@ -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, @@ -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, @@ -970,7 +972,7 @@ async def do_requests( token=PerpCollateralToken.PCTK_SOL, type=PerpCollateralType.PCT_TRANSFER, to_account_address=( - "AbnwAQGrYnvktT4ihhX5np8RbgtfXJfPwpgMJnCFa4MT" + "9UnwdvTf5EfGeLyLrF4GZDUs7LKRUeJQzW7qsDVGQ8sS" ), ) ) diff --git a/bxsolana/provider/http.py b/bxsolana/provider/http.py index 3f3933a..f2588e1 100644 --- a/bxsolana/provider/http.py +++ b/bxsolana/provider/http.py @@ -632,7 +632,7 @@ 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}" @@ -640,7 +640,7 @@ async def get_open_orders_v2( 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, diff --git a/setup.cfg b/setup.cfg index 9959622..7fbc710 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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