sammchardy / python-binance-chain

Binance Chain Exchange API python implementation for automated trading
http://python-binance-chain.rtfd.io
MIT License
302 stars 132 forks source link

PRODUCTION: Wallet environment doesn't match HttpApiClient environment #14

Closed jaggedsoft closed 5 years ago

jaggedsoft commented 5 years ago

Hi friend, I'm not passing any environment but am still getting this message:

  File "test.py", line 21, in <module>
    res = client.broadcast_msg(new_order_msg, sync=True)
  File "/usr/local/lib/python3.7/site-packages/binance_chain/http.py", line 367, in broadcast_msg
    raise BinanceChainBroadcastException("Wallet environment doesn't match HttpApiClient environment")
binance_chain.exceptions.BinanceChainBroadcastException: Wallet environment doesn't match HttpApiClient environment

Thanks for your help and I can offer to pay for support if it helps get this problem resolved quicker

from binance_chain.http import HttpApiClient
from binance_chain.messages import NewOrderMsg, CancelOrderMsg, LimitOrderSellMsg
from binance_chain.constants import KlineInterval, TimeInForce, OrderSide, OrderType
from binance_chain.wallet import Wallet
from decimal import *

wallet = Wallet("privateKey")
client = HttpApiClient()

new_order_msg = NewOrderMsg(
    wallet=wallet,
    symbol="LTO-BDF_BNB",
    time_in_force=TimeInForce.GOOD_TILL_EXPIRE,
    order_type=OrderType.LIMIT,
    side=OrderSide.BUY,
    price=Decimal(0.00350009),
    quantity=Decimal(1),
)
res = client.broadcast_msg(new_order_msg, sync=True)
jaggedsoft commented 5 years ago

@sammchardy you're awesome for making this by the way, this one is way better than all the other API's.

jaggedsoft commented 5 years ago

Fixed with env = BinanceEnvironment.get_production_env()