def main_example_get_nat_hc_odds(): """ example for get_fball_natural_hc_odds() """ from datetime import datetime timestamp = datetime(2018, 5, 5, 15, 30, tzinfo=pytz.UTC) abc_db = get_connection('football') o = get_natural_hc_odds( event_id='GSM2463159', market_abr='FTOUC', timestamp=timestamp, abc_db=abc_db, delta_stale=timedelta(seconds=250), return_series=True) pprint(o)
---------- tick: (dict) tick from abc market data Returns ------- - lay price rescaled """ if tick is None or tick[MarketTick.lay_price.db_field] < 1 * SCALE_FACTOR: return None return tick[MarketTick.lay_price.db_field] / SCALE_FACTOR def get_tick_mid_price(tick): bp = get_tick_bp(tick) lp = get_tick_lp(tick) if bp is None or lp is None: return None else: return (bp + lp) / 2. if __name__ == '__main__': conn = get_connection('tennis') # print get_sticker_odds(conn, 'T-EENP1923578-FT12-A.BF') cache = FixtureCache() kickoff = cache.get_kickoff('ENP2191253') # print get_sanitized_sticker_odds(conn, 'T-EENP2191253-FT12-A.BF', kickoff) print get_last_tick_before(conn, 'T-EENP2191253-FT12-A.BF', kickoff) # print existing_stickers_from_meta(conn, 'ENP1923578')
from datetime import datetime timestamp = datetime(2018, 5, 5, 15, 30, tzinfo=pytz.UTC) abc_db = get_connection('football') o = get_natural_hc_odds( event_id='GSM2463159', market_abr='FTOUC', timestamp=timestamp, abc_db=abc_db, delta_stale=timedelta(seconds=250), return_series=True) pprint(o) if __name__ == '__main__': logging.getLogger().setLevel(logging.DEBUG) conn = get_connection('football') main_example_get_nat_hc_odds() # res_ts = nat_ah_hc(conn, 'GSM2465138', 'FTAHG') # print pd.DataFrame(res_ts) # # print get_sticker(conn, 'T-EENP1923578-FT12-A.BF') # cache = FixtureCache() # kickoff = cache.get_kickoff('ENP2191253') # # print nat_ou_hc(conn, 'GSM1487207', 'FTOUG') # print nat_ou_hc_odds(conn, 'ENP2180538', 'TGOU') # # print nat_ah_hc(conn, 'ENP2180538', 'HG')