Source code for onetick.py.servers
[docs]class RemoteTS(object):
def __init__(self, host, port=None, cep=False):
"""
Class representing remote tick-server.
Can be :py:meth:`used <onetick.py.Session.use>`
in :py:class:`~onetick.py.Session` as well as the local databases.
Parameters
----------
host: str
string with the domain name or ip-address of the remote server
and, optionally, the port number after the ``:`` character.
port: int, str
the port number of the remote tick-server.
If not specified here, can be specified in the ``host`` parameter.
cep: bool
specifies if the remote server is the CEP-mode tick-server.
Examples
--------
>>> session.use(otp.RemoteTS('server.onetick.com:50015')) # doctest: +SKIP
"""
if port is None:
self._host, self._port = host.split(':')
else:
self._host, self._port = host, port
self.cep = cep
def __repr__(self):
return self.__str__()
def __str__(self):
return f"{self._host}:{self._port}"
laser = RemoteTS("192.168.5.63", "50025")