Exemplo n.º 1
0
                    seed=np.random.randint(low=0, high=2**32, dtype='uint64')))

kernelStartTime = historical_date
kernelStopTime = mkt_close + pd.to_timedelta('00:01:00')

defaultComputationDelay = 50  # 50 nanoseconds

# LATENCY

latency_rstate = np.random.RandomState(
    seed=np.random.randint(low=0, high=2**32))
pairwise = (agent_count, agent_count)

# All agents sit on line from Seattle to NYC
nyc_to_seattle_meters = 3866660
pairwise_distances = util.generate_uniform_random_pairwise_dist_on_line(
    0.0, nyc_to_seattle_meters, agent_count, random_state=latency_rstate)
pairwise_latencies = util.meters_to_light_ns(pairwise_distances)

model_args = {'connected': True, 'min_latency': pairwise_latencies}

latency_model = LatencyModel(latency_model='deterministic',
                             random_state=latency_rstate,
                             kwargs=model_args)
# KERNEL

kernel.runner(agents=agents,
              startTime=kernelStartTime,
              stopTime=kernelStopTime,
              agentLatencyModel=latency_model,
              defaultComputationDelay=defaultComputationDelay,
              oracle=oracle,
Exemplo n.º 2
0
kernelStartTime = historical_date
kernelStopTime = mkt_close + pd.to_timedelta('00:01:00')

defaultComputationDelay = 0  # 50 nanoseconds #there was 50, doesn't work for MarketReplay as this is history that should be
#executed at exact order book time.

# LATENCY

latency_rstate = np.random.RandomState(
    seed=np.random.randint(low=0, high=2**32))
pairwise = (agent_count, agent_count)

# All agents sit on line from my PC to MICEX
me_to_micex_meters = 10000
pairwise_distances = util.generate_uniform_random_pairwise_dist_on_line(
    0.0, me_to_micex_meters, agent_count, random_state=latency_rstate)
pairwise_latencies = util.meters_to_light_ns(pairwise_distances)

model_args = {'connected': True, 'min_latency': pairwise_latencies}

latency_model = LatencyModel(latency_model='deterministic',
                             random_state=latency_rstate,
                             kwargs=model_args)
# KERNEL

latency = np.zeros(
    (agent_count,
     agent_count))  #TODO: check this way to setup separate latency for agent
noise = [0.0]

kernel.runner(