예제 #1
0
 def __init__(self, data, intrade, contracts):
     threading.Thread.__init__(self)
     self.logger = init_logger(__name__, 'error')
     self.data = data
     self.intrade = intrade
     self.contracts = contracts
     self.last_new = 0
예제 #2
0
 def __init__(self, data, intrade, contracts):
     threading.Thread.__init__(self)
     self.logger = init_logger(__name__, 'error')
     self.data = data
     self.intrade = intrade
     self.contracts = contracts
     self.last_new = 0
예제 #3
0
def main():

    logger = init_logger(__file__, 'debug', email = False)
    logger.info('began execution')

    conn = pymongo.Connection()
    data = conn.intrade

    intrade = intrade_api.Intrade()
    intrade.sandbox = False # this should always use real data

    for contract_group in [rec['contracts'] for rec in data.contract_groups.find()]:
        contracts = [int(contract['id']) for contract in contract_group]
        price_thread = PriceScraper(data, intrade, contracts)
        price_thread.setDaemon(True)
        price_thread.start()

    while True:

        time.sleep(60)
예제 #4
0
def main():

    logger = init_logger(__file__, 'debug', email=False)
    logger.info('began execution')

    conn = pymongo.Connection()
    data = conn.intrade

    intrade = intrade_api.Intrade()
    intrade.sandbox = False  # this should always use real data

    for contract_group in [
            rec['contracts'] for rec in data.contract_groups.find()
    ]:
        contracts = [int(contract['id']) for contract in contract_group]
        price_thread = PriceScraper(data, intrade, contracts)
        price_thread.setDaemon(True)
        price_thread.start()

    while True:

        time.sleep(60)
예제 #5
0
def cleanup():
    logger = init_logger('cleanup', 'info')
    logger.info('stopped execution')
예제 #6
0
def cleanup():
    logger = init_logger('cleanup', 'info')
    logger.info('pyntrader.py stopped execution')
예제 #7
0
        if strategy['strategy'] == 'FoK':
            print 'do stuff'

        elif strategy['strategy'] == 'limit':
            print 'do stuff'

        sleep(1)

def cleanup():
    logger = init_logger('cleanup', 'info')
    logger.info('pyntrader.py stopped execution')

if __name__ == '__main__':
    atexit.register(cleanup)

    logger = init_logger(__file__, 'info', email = False)
    logger.info('pyntrader.py began execution')

    conn = pymongo.Connection()
    data = conn.intrade

    intrade = intrade_api.Intrade()

    groups, contract_ids = {}, set()
    
    for rec in data.contract_groups.find({'trade': True}):
        groups[str(rec['_id'])] = [int(contract['id']) for contract in rec['contracts']]
        [contract_ids.add(int(contract['id'])) for contract in rec['contracts']]

    # override for testing environment
    groups = {'fake_id': [320111, 320112]}
예제 #8
0
    def __init__(self, config_path='intrader.conf'):

        self.extract_config(config_path)
        self.session = self.get_login()['sessionData']
        self.logger = init_logger(__name__, 'debug', email=False)