Esempio n. 1
0
    def __init__(self, market=Market.BtcCny):
        if (not isinstance(market, Market)):
            raise ValueError("market is not defined")

        self._base_url = "https://data.btcchina.com/data/"
        self._market = market
        self._logger = create_timed_rotating_log()
Esempio n. 2
0
 def __init__(self, account_name, account_key, container, prefix):
     self._blob = BlobService(account_name=account_name, account_key=account_key)
     self._cur_path = None
     self._buf = io.StringIO()
     self._prefix = prefix
     self._container = container
     self._blob.create_container(container)
     self._logger = create_timed_rotating_log()
Esempio n. 3
0
    def __init__(self, config):
        self._config = config
        self._type = self._config["type"]
        self._market = Market(self._config["market"])
        self._client = btcc_client(self._market)
        self._interval = self._config["interval"]
        self._schema = self._config["schema"]

        self._prefix = self._config["prefix"]
        self._account_name = self._config["account_name"]
        self._account_key = self._config["account_key"]
        self._container = self._config["container"]
        self._writer = azure_storage_writer(self._account_name, self._account_key, self._container, self._prefix)
        self._logger = create_timed_rotating_log()
Esempio n. 4
0
 def __init__(self):
     self._logger = create_timed_rotating_log()
     self._base_url = "http://api.huobi.com/staticmarket/"
Esempio n. 5
0
import json
import sys
from btcc_trade_collector import bttc_trade_collector
from btcc_client import Market
from btcc_log import create_timed_rotating_log
from btcc_log import set_log_name_prefix



with open("./collector_config.json") as config_file:
    config = json.load(config_file)

if (len(sys.argv) != 2):
    print ("Usage: python run_collector.py [job name]")
    print ("Optional job names are:")
    print ("  ".join(config["jobs"].keys()))
    sys.exit(1)

common = config["common"]
jobname = sys.argv[1]
job = config["jobs"][jobname]

set_log_name_prefix(jobname)
logger = create_timed_rotating_log()

submit_config = common.copy()
submit_config.update(job)
a = bttc_trade_collector(submit_config)
logger.info("btcc collector started with the following config:")
logger.info(json.dumps(submit_config))
a.run()