Esempio n. 1
0
 def enable_debug(self):
     '''see help -- run local-only'''
     global DEBUG, logger
     DEBUG = True
     if self.verbose:
         logger = create_logger('debug-CrestOrderBook', HERE, config,
                                'DEBUG')
    dataframe = dataframe.append(dataframe2)
    dataframe.set_index(
        keys='price_datetime',
        #keys=('price_datetime','typeid','locationid'),
        drop=True,
        inplace=True)

    if DEBUG: dataframe.to_csv('pandas_snapshot_evecentral.csv')
    return dataframe


## MAIN = TEST ##
if __name__ == '__main__':
    print(ME)
    DEBUG = True
    DEBUG_LOGGER = create_logger('debug_snapshot_evecentral', HERE, None,
                                 'DEBUG')
    DEBUG_LOGGER.log(10, '**STARTING TEST RUN**')
    #CONNECTION_VALUES = table_utils.get_config_values(config, ME)
    #print(CONNECTION_VALUES)
    SAMPLE_DATA_FRAME = build_sample_dataframe(2, 12)
    TEST_OBJECT = snapshot_evecentral(CONNECTION_VALUES['table'],
                                      debug=DEBUG,
                                      loging_handle=DEBUG_LOGGER)
    TEST_OBJECT.put_data(SAMPLE_DATA_FRAME)
    TEST_DATA = TEST_OBJECT.get_data(
        10,
        "sell_min",
        "sell_volume",
        locationid=99999999,  #30000142,
        typeid=[34, 40, 99],
    )
Esempio n. 3
0
        'volume': volumes,
        'lowPrice': pricelows,
        'highPrice': pricehighs,
        'avgPrice': priceavgs
    })

    dataframe.set_index(keys='price_date', drop=True, inplace=True)
    if DEBUG: print(dataframe)
    return dataframe


## MAIN = TEST ##
if __name__ == '__main__':
    print(ME)
    DEBUG = True
    DEBUG_LOGGER = create_logger('debug_crest_markethistory', HERE, None,
                                 'DEBUG')
    DEBUG_LOGGER.log(10, '**STARTING TEST RUN**')

    #CONNECTION_VALUES = table_utils.get_config_values(config, ME)
    SAMPLE_DATA_FRAME = build_sample_dataframe(10)
    TEST_OBJECT = crest_markethistory(CONNECTION_VALUES['table'],
                                      debug=DEBUG,
                                      loging_handle=DEBUG_LOGGER)
    TEST_OBJECT.put_data(SAMPLE_DATA_FRAME)
    TEST_OBJECT.latest_entry(regionid=99999999, typeid=34)
    TEST_DATA = TEST_OBJECT.get_data(
        10,
        "avgPrice",
        "volume",
        regionid=99999999,  #30000142,
        typeid=[34, 40],
Esempio n. 4
0
from plumbum import cli
from tinydb import TinyDB, Query

requests.models.json = json

from prosper.common.prosper_logging import create_logger
from prosper.common.prosper_config import get_config
import prosper.common.prosper_utilities as p_util
from prosper.warehouse.FetchConnection import *
from prosper.warehouse.Connection import *

HERE = path.abspath(path.dirname(__file__))
ME = __file__.replace('.py', '')
CONFIG_ABSPATH = path.join(HERE, 'cron_config.cfg')
config = get_config(CONFIG_ABSPATH)
logger = create_logger('debug-CrestHistoryFetch', HERE, config, 'DEBUG')

DEFAULT_REGION = config.get(ME, 'default_region')
CACHE_ABSPATH = path.join(HERE, config.get('GLOBAL', 'cache_path'))
if not path.exists(CACHE_ABSPATH):
    makedirs(CACHE_ABSPATH)

TYPEID_CACHE_FILE = path.join(CACHE_ABSPATH, config.get(ME, 'typeid_cache'))
TYPEID_CACHE_AGE = config.get(ME, 'cache_age')
TYPEID_DB = TinyDB(TYPEID_CACHE_FILE)


def get_valid_typeids(force_refresh=False):
    '''get valid typeids from tinydb local cache'''
    logger.info('checking tinydb for list of typeids')
Esempio n. 5
0
from weighted import quantile as wquantile  #wquantile -- dev is bad and should feel bad
from plumbum import cli
import ujson as json
requests.models.json = json  #https://github.com/kennethreitz/requests/issues/1595

from prosper.common.prosper_logging import create_logger
from prosper.common.prosper_config import get_config
from prosper.warehouse.FetchConnection import *
from prosper.warehouse.Connection import *  #OPTIONAL: for Exception handling

HERE = path.abspath(path.dirname(__file__))
ME = __file__.replace('.py', '')
CONFIG_ABSPATH = path.join(HERE, 'cron_config.cfg')

config = get_config(CONFIG_ABSPATH)
logger = create_logger('debug-CrestOrderBook', HERE, config)

## CREST GLOBALS ##
CREST_BASE_URL = config.get('GLOBAL', 'crest_base_url')
ENDPOINT_URI = config.get(ME, 'crest_endpoint')
SOLARSYSTEM_ENDPOINT = config.get(ME, 'solarsystem_endpoint')
PAGE_URI = config.get(ME, 'page_uri')
USERAGENT = config.get('GLOBAL', 'useragent')
RETRY_COUNT = int(config.get('GLOBAL', 'retry_count'))
RETRY_TIME = int(config.get('GLOBAL', 'retry_time')) * 1000  #ms
HUB_LIST = map(int, config.get(ME, 'hub_list').split(','))
OUTLIER_FACTOR = int(config.get(ME, 'outlier_factor'))
DEBUG = False


def timeit(method):