smarkets / smk_python_sdk Goto Github PK
View Code? Open in Web Editor NEWSmarkets Python SDK
Home Page: http://smarkets.github.com/
License: MIT License
Smarkets Python SDK
Home Page: http://smarkets.github.com/
License: MIT License
https://github.com/smarkets/smk_python_sdk/blob/master/smarkets/odds.py#L594
snap_to_decimal() snap_to_decimal_move_out_by()
These function can return None. This feels wrong especially for snap_to_decimal().
I think an exception would be neater.
I'm following documentation and I'm getting an error trying to log in.
Is this package still being maintained?
Is there a plan to maintain it?
Error
smarkets.streaming_api.exceptions.ConnectionError: Error -2 connecting stream.smarkets.com:3801. Name or service not known.
import logging
logging.basicConfig(level=logging.DEBUG)
from smarkets.streaming_api.api import SessionSettings, Session, StreamingAPIClient
username = '[email protected]'
password = 'barpassword'
settings = SessionSettings(username, password)
settings.host = 'stream.smarkets.com'
session = Session(settings)
client = StreamingAPIClient(session)
client.login()
Thanks
If you have more than one client, their Callback objects are the same.
>>> import smarkets.clients
>>> a = smarkets.clients.Smarkets('_')
>>> b = smarkets.clients.Smarkets('_')
>>> def h(msg): print repr(("client a received", msg))
...
>>> a.add_handler('seto.http_found', h)
# pretend b is connected and got a message...
>>> b.callbacks['seto.http_found']('example_message')
('client a received', 'example_message')
Snippet in https://github.com/smarkets/smk_python_sdk#getting-started is outdated.
Looks like:
Expected behaviour:
After copy pasting it to Python REPL (with correct credentials, market_id and contract_id) it should login and place a bet.
Hi, I try to run the intro script and can't resolve host "stream.smarkets.com"
I also cant resolve it using google DNS server. On older "api.smarkets.com" I get timeout error.
>>> client.login()
INFO:smarkets.session.socket:connecting with new socket to stream.smarkets.com:3801
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/anaconda2/lib/python2.7/site-packages/smarkets/streaming_api/client.py", line 54, in login
self.session.connect()
File "/opt/anaconda2/lib/python2.7/site-packages/smarkets/streaming_api/session.py", line 90, in connect
if self.socket.connect():
File "/opt/anaconda2/lib/python2.7/site-packages/smarkets/streaming_api/session.py", line 253, in connect
reraise(ConnectionError(self._error_message(exc)))
File "/opt/anaconda2/lib/python2.7/site-packages/smarkets/errors.py", line 13, in reraise
_six.reraise(type(exception), exception, tb)
File "/opt/anaconda2/lib/python2.7/site-packages/smarkets/streaming_api/session.py", line 249, in connect
sock.connect((self.settings.host, self.settings.port))
File "/opt/anaconda2/lib/python2.7/ssl.py", line 876, in connect
self._real_connect(addr, False)
File "/opt/anaconda2/lib/python2.7/ssl.py", line 863, in _real_connect
socket.connect(self, addr)
File "/opt/anaconda2/lib/python2.7/socket.py", line 228, in meth
return getattr(self._sock,name)(*args)
smarkets.streaming_api.exceptions.ConnectionError: Error -2 connecting stream.smarkets.com:3801. Name or service not known.
>>>
Frames of less than 4 bytes are supposed to be padded to 4 bytes. According to https://github.com/smarkets/smk_python_sdk/blob/master/smarkets/sessions.py#L266 it seems though as if they are padded to 3 bytes. IMO this should read padding = '\x00' * max(0, 4 - byte_count)
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.