示例#1
0
    def __init__(self):
        super().__init__()
        d = super().session()
        self.igstreamclient = igstream.IGStream(igclient=self, loginresponse=d)

        subscription = igstream.Subscription(
            mode="DISTINCT",
            items=["TRADE:" + str(self.accountId)],
            fields=["OPU"])

        self.igstreamclient.subscribe(subscription=subscription,
                                      listener=on_item_update)
        self.market_ids = {}

        # get open positions
        self.open_positions = super().positions()
示例#2
0
from sklearn.linear_model import LinearRegression
##################################################
import sys, os
import configparser

from igclient import IGClient
import igstream

igclient = IGClient()

config = configparser.ConfigParser()
config.read("default.conf")
config.read("config.conf")

d = igclient.session()
igstreamclient = igstream.IGStream(igclient=igclient, loginresponse=d)

subscription = igstream.Subscription(
    mode="DISTINCT",
    items=["TRADE:" + str(igclient.accountId)],
    fields=["OPU"])


def on_item_update(item_update):
    print(item_update)


igstreamclient.subscribe(subscription=subscription, listener=on_item_update)

# get open positions
open_positions = igclient.positions()