def __init__(self, api_client=None): if api_client is None: api_client = ApiClient() self.api_client = api_client
def sandbox_api_client(token): sandbox_host = 'https://api-invest.tinkoff.ru/openapi/sandbox/' conf = Configuration(host=sandbox_host) conf.access_token = token return SandboxOpenApi(ApiClient(configuration=conf))
def api_client(token): host = 'https://api-invest.tinkoff.ru/openapi/' conf = Configuration(host=host) conf.access_token = token return OpenApi(ApiClient(configuration=conf))
def __init__(self, token: str, brocker_id: int): self.host = 'https://api-invest.tinkoff.ru/openapi/' self.conf = Configuration(host=self.host) self.conf.access_token = token self.brocker_id = brocker_id super().__init__(ApiClient(configuration=self.conf))