oanda / v20-python

OANDA v20 bindings for Python
MIT License
223 stars 89 forks source link

Native data types #15

Closed alekna closed 7 years ago

alekna commented 7 years ago

Native data types seems to be broken in 3.0.12. It is returning str instead of float.

Sample code:

            for msg_type, msg in response.parts():
                if msg.type == 'PRICE':
                    print('Bid {}\tAsk {}'.format(
                        type(msg.bids[0].price),
                        type(msg.asks[0].price),
                    ))

Returns:

Bid <class 'str'>   Ask <class 'str'>
Bid <class 'str'>   Ask <class 'str'>

Used to return float in 3.0.11

alekna commented 7 years ago

Just leave it as it is. I'll cast data myself. After some thinking process it doesn't seem such a bad idea to me anymore.