示例#1
0
        random_state=np.random.RandomState(
            seed=np.random.randint(low=0, high=2**32, dtype='uint64')))
    for j in range(agent_count, agent_count + num_mm_agents)
])
agent_count += num_mm_agents
agent_types.extend('MarketMakerAgent')

# 5) Momentum Agents
num_momentum_agents = 25
agents.extend([
    MomentumAgent(
        id=j,
        name="MOMENTUM_AGENT_{}".format(j),
        type="MomentumAgent",
        symbol=symbol,
        starting_cash=starting_cash,
        min_size=1,
        max_size=10,
        log_orders=log_orders,
        random_state=np.random.RandomState(
            seed=np.random.randint(low=0, high=2**32, dtype='uint64')))
    for j in range(agent_count, agent_count + num_momentum_agents)
])
agent_count += num_momentum_agents
agent_types.extend("MomentumAgent")

########################################################################################################################
########################################### KERNEL AND OTHER CONFIG ####################################################

kernel = Kernel("random_fund_diverse Kernel",
                random_state=np.random.RandomState(
示例#2
0
                             random_state=np.random.RandomState(
                                 seed=np.random.randint(low=0, high=2**32)))
    for idx, j in enumerate(range(agent_count, agent_count + num_mm_agents))
])
agent_count += num_mm_agents
agent_types.extend('AdaptiveMarketMakerAgent')

# 5) Momentum Agents
num_momentum_agents = 25
agents.extend([
    MomentumAgent(id=j,
                  name="MOMENTUM_AGENT_{}".format(j),
                  type="MomentumAgent",
                  symbol=symbol,
                  starting_cash=starting_cash,
                  min_size=1,
                  max_size=10,
                  wake_up_freq='20s',
                  log_orders=True,
                  random_state=np.random.RandomState(
                      seed=np.random.randint(low=0, high=2**32)))
    for j in range(agent_count, agent_count + num_momentum_agents)
])
agent_count += num_momentum_agents
agent_types.extend("MomentumAgent")

# 6) Execution Agent Config
trade = True if args.execution_agents else False

execution_agent_start_time = historical_date + pd.to_timedelta("10:00:00")
execution_agent_end_time = historical_date + pd.to_timedelta("11:00:00")
示例#3
0
    ) for idx, j in enumerate(range(agent_count, agent_count + num_mm_agents))
])
agent_count += num_mm_agents
agent_types.extend("POVMarketMakerAgent")

# 5) Momentum Agents
num_momentum_agents = 5

agents.extend([
    MomentumAgent(
        id=j,
        name="MOMENTUM_AGENT_{}".format(j),
        type="MomentumAgent",
        symbol=symbol,
        starting_cash=starting_cash,
        min_size=1,
        max_size=10,
        wake_up_freq="20s",
        log_orders=log_orders,
        random_state=np.random.RandomState(
            seed=np.random.randint(low=0, high=2**32, dtype="uint64")),
    ) for j in range(agent_count, agent_count + num_momentum_agents)
])
agent_count += num_momentum_agents
agent_types.extend("MomentumAgent")

# 6) Execution Agent

trade = True if args.execution_agents else False

#### Participation of Volume Agent parameters
示例#4
0
    agent_types.extend([
        "HeuristicBeliefLearningAgent {}".format(strat_name)
        for j in range(x[0])
    ])
    agent_count += x[0]

# Trend followers agent
i = agent_count
lookback = 10
num_tf = 20
for j in range(num_tf):
    agents.append(
        MomentumAgent(i,
                      "Momentum Agent {}".format(i),
                      symbol=symbol1,
                      starting_cash=starting_cash,
                      lookback=lookback,
                      random_state=np.random.RandomState(
                          seed=np.random.randint(low=0, high=2**32)),
                      log_orders=log_orders))
    agent_types.append("MomentumAgent {}".format(i))
    i += 1
agent_count += num_tf

#for j in range(num_tf):
#agents.append(MomentumAgent(i, "Momentum Agent {}".format(i), symbol=symbol2, startingCash = starting_cash, lookback=lookback))
#agent_types.append("MomentumAgent {}".format(i))
#i+=1
#agent_count += num_tf

#for j in range(num_tf):
#agents.append(MomentumAgent(i, "Momentum Agent {}".format(i), symbol=symbol3, startingCash = starting_cash, lookback=lookback))
示例#5
0
  # Add an OBI agent to try to beat this market.
  for i in range(num_obi):
    random_state = get_rand_obj(agent_seeds[agent_id])
    agents.extend([ OrderBookImbalanceAgent(agent_id, "OBI Agent {}".format(agent_id), "OrderBookImbalanceAgent", symbol = symbol, starting_cash = starting_cash, levels = levels, entry_threshold = entry_threshold, trail_dist = trail_dist, freq = obi_freq, random_state = random_state) ])
    agent_id += 1

  # Add market maker agents.
  for i in range(num_mm):
    random_state = get_rand_obj(agent_seeds[agent_id])
    agents.extend([ MarketMakerAgent(agent_id, "Market Maker Agent {}".format(agent_id), "MarketMakerAgent", symbol=symbol, starting_cash=starting_cash, min_size=500, max_size=1000, subscribe=True, log_orders=False, random_state = random_state) ])
    agent_id += 1

  # Add momentum agents.
  for i in range(num_mom):
    random_state = get_rand_obj(agent_seeds[agent_id])
    agents.extend([ MomentumAgent(agent_id, "Momentum Agent {}".format(agent_id), "MomentumAgent", symbol=symbol, starting_cash=starting_cash, min_size=1, max_size=10, subscribe=True, log_orders=False, random_state = random_state) ])
    agent_id += 1


  # Start the kernel running.  This call will not return until the
  # simulation is complete.  (Eventually this should be made
  # parallel for learning.)
  agent_saved_states = kernel.runner(
                agents = agents, startTime = kernelStartTime,
                stopTime = kernelStopTime, agentLatency = latency,
                latencyNoise = noise,
                defaultComputationDelay = defaultComputationDelay,
                oracle = oracle, log_dir = "{}_{}".format(log_dir,sim))

  obi_perf.append(agent_saved_states['agent_state'][0])