예제 #1
0
def get_client_config():
    client_config = TigerOpenClientConfig(sandbox_debug=False)
    client_config.language = Language.en_US

    client_config.private_key = read_private_key(
        '/Users/yunqiuliu/Tiger-Trade/rsa_private_key.pem')
    client_config.tiger_id = '20150081'
    client_config.account = 'U8317066'
    return client_config
예제 #2
0
def get_client_config():
    """ 获取client_config
    https://www.itiger.com/openapi/info 开发者信息获取
    """
    client_config = TigerOpenClientConfig(sandbox_debug=False)
    client_config.private_key = read_private_key('/Users/yunqiuliu/Tiger-Trade/rsa_private_key.pem')
    client_config.tiger_id = '20150081'
    client_config.account = 'U8317066'
    client_config.language = Language.en_US
    return client_config
예제 #3
0
def get_client_config():
    """
    https://www.itiger.com/openapi/info 开发者信息获取
    :return:
    """
    is_sandbox = False
    client_config = TigerOpenClientConfig(sandbox_debug=is_sandbox)
    client_config.private_key = read_private_key('your private key file path')
    client_config.tiger_id = 'your tiger id'
    client_config.account = 'your account'
    client_config.language = Language.en_US
    return client_config
예제 #4
0
파일: bc_tiger.py 프로젝트: dxcv/quant-1
def get_client_config(account='global_account',
                      info_path='drive/My Drive/tiger_quant/',
                      is_sandbox=False):
    user_info = get_user_info(info_path=info_path)

    client_config = TigerOpenClientConfig(sandbox_debug=is_sandbox)
    client_config.private_key = read_private_key(info_path +
                                                 user_info['private_key_name'])
    client_config.tiger_id = str(user_info['tiger_id'])
    client_config.account = str(user_info[account])
    client_config.language = Language.en_US

    return client_config
예제 #5
0
def get_client_config():
    """
    https://www.itiger.com/openapi/info 开发者信息获取
    :return:
    """
    is_sandbox = False
    client_config = TigerOpenClientConfig(sandbox_debug=is_sandbox)
    client_config.private_key = rsa_private_key
    client_config.tiger_id = '20150137'
    client_config.account = None # 'U9923867'  # 环球账户
    client_config.standard_account = None  # 标准账户
    client_config.paper_account = '20190130122050760'  # 模拟账户
    client_config.language = Language.zh_CN
    return client_config
예제 #6
0
def get_client_config():
    """
    https://www.itiger.com/openapi/info 开发者信息获取
    :return:
    """
    is_sandbox = False
    client_config = TigerOpenClientConfig(sandbox_debug=is_sandbox)
    client_config.private_key = read_private_key('your private key file path')
    client_config.tiger_id = 'your tiger id'
    client_config.account = 'your account'  # 环球账户.
    # 只使用一个账户时,不论是环球账户, 标准账户或是模拟账户, 都填在 client_config.account 下, 默认只会使用这里的账户.
    # standard_account 属性和 paper_account 属性只是为多账户时取用方便, 一般可忽略
    client_config.standard_account = None  # 标准账户
    client_config.paper_account = None  # 模拟账户
    client_config.language = Language.en_US
    return client_config
예제 #7
0
def get_client_config():
    """
    https://www.itiger.com/openapi/info 开发者信息获取
    :return:
    """
    # Load tiger account information
    prop = Property()
    prop_loader = prop.load_property_files(
        os.path.expanduser('~/config/env.properties'))
    tiger_id = prop_loader.get('tiger_id')
    tiger_account = prop_loader.get('tiger_account')

    is_sandbox = False
    client_config = TigerOpenClientConfig(sandbox_debug=is_sandbox)
    client_config.private_key = read_private_key(
        os.path.expanduser('~/.ssh/tigerbroker_rsa_private_key.pem'))
    client_config.tiger_id = tiger_id
    client_config.account = tiger_account
    client_config.language = Language.en_US

    return client_config
예제 #8
0
from tigeropen.common.util.signature_utils import read_private_key
from tigeropen.push.push_client import PushClient
from tigeropen.tiger_open_config import TigerOpenClientConfig


def on_query_subscribed_quote(symbols, focus_keys, limit, used):
    print(symbols, focus_keys, limit, used)


def on_quote_changed(symbol, items, hour_trading):
    print(symbol, items, hour_trading)


is_sandbox = True
client_config = TigerOpenClientConfig(sandbox_debug=is_sandbox)
client_config.private_key = read_private_key('your private key file path')
# https://www.itiger.com/openapi/info 开发者信息获取
client_config.tiger_id = 'your tiger id'
client_config.account = 'your account'
client_config.language = Language.en_US
protocol, host, port = client_config.socket_host_port
push_client = PushClient(host, port, use_ssl=(protocol == 'ssl'))
push_client.quote_changed = on_quote_changed
push_client.subscribed_symbols = on_query_subscribed_quote
push_client.connect(client_config.tiger_id, client_config.private_key)
push_client.query_subscribed_quote()
push_client.subscribe_quote(['AAPL', 'GOOG'])
push_client.subscribe_asset()

# time.sleep(600)
push_client.disconnect()