Exemplo n.º 1
0
def get_most_recent_unit(symbol):
    system_config = SystemConfig()
    loader_table = TableObjectLoaderDisk(system_config.load_path_dir_database())
    table_source = loader_table.load_table_for_list_key(['trading', 'option', symbol])
    key = sorted(table_source.load_list_key())[-1]
    series_option_chain = table_source.load_json_for_list_key([key])
    series_option_chain_unit = SeriesOptionChain.to_unit(series_option_chain)
    return series_option_chain_unit
 def __init__(self, list_symbol):
     self.list_symbol = list_symbol
     super(SystemScrapeOption, self).__init__()
     self.client = ClientNasdaqGetto()
     system_config = SystemConfig()
     loader_table = TableObjectLoaderDisk(
         system_config.load_path_dir_database())
     self.table = loader_table.load_table_for_list_key(
         ['trading', 'option'])
     self.timestamp_scape_last = 0
def load_series_option_chain(symbol):
    list_key_table = ['trading', 'option', symbol]
    table_loader = ToolsClient.create_client('XXXX',
                                             name_host='10.100.10.63',
                                             name_port='5001')
    # table_loader = ToolsClient.create_client('XXXX', name_host='127.0.0.1', name_port='5000') #localhost
    table_object = table_loader.load_table_for_list_key(list_key_table)
    system_config = SystemConfig()
    key_most_recent = sorted(table_object.load_list_key())[-1]
    series_option_chain = json.loads(
        table_object.load_bytearray_for_key(key_most_recent))
    return series_option_chain
Exemplo n.º 4
0
import sys
import os
import json

sys.path.append(os.path.abspath('../../rivernode_core'))
from rivernode_core.system_config import SystemConfig
from rivernode_core.persistency.table_object_loader_disk import TableObjectLoaderDisk

sys.path.append(os.path.abspath('../../rivernode_finance'))
from rivernode_finance.tools_option import ToolsOption

system_config = SystemConfig()
loader_table = TableObjectLoaderDisk(system_config.load_path_dir_database())
list_symbol = loader_table.load_table_for_list_key(['trading', 'option'
                                                    ]).load_list_key_table()

for index, symbol in enumerate(list_symbol):
    print(symbol)
    table_source = loader_table.load_table_for_list_key(
        ['trading', 'option', symbol])
    table_target = loader_table.load_table_for_list_key(
        ['trading', 'option_result', symbol])

    if symbol in ['LBTYA', 'TMUS']:
        continue
    key = sorted(table_source.load_list_key())[-1]
    if not table_target.has_object_for_key(key):
        series_option_chain = table_source.load_json_for_list_key([key])
        result_series_option_chain = ToolsOption.analyse_series_option_chain(
            series_option_chain)
        table_target.save_json_for_list_key([key], result_series_option_chain)
from rivernode_core.system_service import SystemService
from rivernode_core.system_config import SystemConfig
from rivernode_core.persistency.table_object_loader_disk import TableObjectLoaderDisk
from rivernode_core.persistency.route_table_object import RouteTableObject


sys.path.append(os.path.abspath('../../rivernode_chat'))
from rivernode_chat.interface.whatsapp.system_chat_whatsapp import SystemChatWhatsapp
from rivernode_chat.interface.whatsapp.route_chat_whatsapp import RouteChatWhatsapp

#
# load config
#
name_config = os.getenv('NAME_CONFIG', 'config-win-default')
#TODO get this by esb
system_config = SystemConfig(name_config)
# loader_table_object = TableObjectLoaderDisk(system_config.load_path_dir_database())

system_chat_whatsapp = SystemChatWhatsapp()
route_chat_whatsapp = RouteChatWhatsapp(system_chat_whatsapp)
#
# end config
#

# start components
app = Flask(__name__)
system_service = SystemService('chat_server', '0.4.0', '127.0.0.1', '5000')
system_service.add_routes(app)
system_service.add_route(app, route_chat_whatsapp)

#TODO move this to manager service?