ApeX-Protocol / apexpro-openapi

apexpro openapi python sdk
Other
29 stars 10 forks source link

Error while creating order: AttributeError: 'function' object has no attribute 'get' #15

Open adpandhare opened 1 year ago

adpandhare commented 1 year ago

worstPrice = client.get_worst_price(symbol="BTC-USDC", side="BUY", size="0.01") price = worstPrice['data']['worstPrice'] createOrderRes = client.create_order( symbol="BTC-USDC", side="BUY", type="MARKET", size="0.01", price=price, expirationEpochSeconds= currentTime ) print(createOrderRes)

adpandhare commented 1 year ago

No reponse. This project is dead. Do not use this package.

quantfreedom commented 1 year ago

@adpandhare ... i am guessing you are the same adp in the discord ... this works for me

import time
from quantfreedom.exchanges.apex_exchange.apexpro.http_private_stark_key_sign import HttpPrivateStark
from quantfreedom.exchanges.apex_exchange.apexpro.constants import APEX_HTTP_TEST, NETWORKID_TEST
from my_stuff import ApexTestKeys

key = ApexTestKeys.api_key
secret = ApexTestKeys.secret_key
passphrase = ApexTestKeys.passphrase

public_key = ApexTestKeys.stark_key_public
public_key_y_coordinate = ApexTestKeys.stark_key_y
private_key = ApexTestKeys.stark_key_private

apex_stark = HttpPrivateStark(
    APEX_HTTP_TEST,
    # network_id=NETWORKID_TEST,
    stark_public_key=public_key,
    stark_private_key=private_key,
    stark_public_key_y_coordinate=public_key_y_coordinate,
    api_key_credentials={"key": key, "secret": secret, "passphrase": passphrase},
)
apex_stark.configs()
apex_stark.get_account()

worstPrice = apex_stark.get_worst_price(
    symbol="BTC-USDC",
    side="BUY",
    size=0.01,
)
price = worstPrice["data"]["worstPrice"]
createOrderRes = apex_stark.create_order(
    symbol="BTC-USDC",
    side="BUY",
    type="MARKET",
    size=0.001,
    price=price,
    expirationEpochSeconds=time.time(),
    limitFeeRate=apex_stark.account["takerFeeRate"],
)
print(createOrderRes)