TradingAgents

Documentation for TradingAgents.

TradingAgents.AdaptiveMM_runMethod
AdaptiveMM_run(ticker::Int, parameters::Tuple{Float64, Int, Float64, Int, Int, Int},
                init_conditions::Tuple{Float64, Int, Int, Int},
                server_info::Tuple{String, String, String, String};
                collect_data = false)

Simulate adaptive market-making agent activity.

Arguments

  • ticker::Int: the ticker ID of the asset being traded by the Adaptive Market Maker
  • parameters::Tuple{Float64, Int, Float64, Int, Int, Int}: a tuple of parameters for specifying the Adaptive Market Maker's behavior. The tuple must be of the form (η_ms, γ, δ_tol, inventory_limit, unit_trade_size, trade_freq), where
    • η_ms::Float64: the market share target
    • γ::Int: the risk aversion parameter
    • δ_tol::Float64: the optimization tolerance
    • inventory_limit::Int: the maximum and minimum number of share holdings allowed
    • unit_trade_size::Int: the amount of shares behind each quote
    • trade_freq::Int: the number of seconds between each trading invocation
  • init_conditions::Tuple{Float64, Int, Int, Int}: a tuple of initial conditions for the Adaptive Market Maker. The tuple must be of the form (init_cash, init_z, num_init_quotes, num_init_rounds), where
    • init_cash::Float64: the initial cash balance
    • init_z::Int: the initial inventory
    • num_init_quotes::Int: the number of random quotes to send out per initialization round
    • num_init_rounds::Int: the number of initialization rounds
  • server_info::Tuple{String, String, String, String}: a tuple of server information for connecting to the brokerage/Exchange. The tuple is composed of the following elements:
    • host_ip_address::String: the IP address of the brokerage server
    • port::String: the port number of the brokerage server
    • username::String: the username to be used for the brokerage account
    • password::String: the password to be used for the brokerage account

Keywords

  • collect_data::Bool=false: whether or not to collect data during the simulation
source
TradingAgents.PLP_runMethod
PLP_run(num_traders::Int, num_assets::Int,
        parameters::Tuple{StepRangeLen{Float64}, StepRangeLen{Int}, Int, Int},
        server_info::Tuple{String, String, String, String};
        print_msg:Bool=false)

Simulate zero-intelligence liquidity providers in parallel. To operate these agents in parallel, the Distributed package is used. This function must be called after addprocs(n) has been called, where n is the number of workers to be used.

Arguments

  • num_traders::Int: the number of liquidity providers to simulate
  • num_assets::Int: the number of available assets for the agents to trade
  • parameters::Tuple{StepRangeLen{Float64}, StepRangeLen{Int}, Int, Int}: a tuple of parameters for the simulation. The tuple is composed of the following elements:
    • init_cash_range::StepRangeLen{Float64}: the range of initial cash values for the liquidity providers. E.g., init_cash_range = 10000.0:0.01:30000.0 defines a possible cash balance anywhere between $10,000.00 and $30,000.00.
    • init_shares_range::StepRangeLen{Int}: the range of initial share holdings for the liquidity providers. E.g., init_shares_range = 0:1:120 defines a possible share holding (of each available asset) anywhere between 0 shares and 120 shares.
    • trade_freq::Int: the average number of seconds between trades for each liquidity provider. E.g., trade_freq = 720 means that each liquidity provider will trade approximately once every 720 seconds (12 minutes).
    • num_ids::Int: the number of reserved ids set aside for all other agents in the simulation (e.g., liquidity takers and market makers)
  • server_info::Tuple{String, String, String, String}: a tuple of server information for connecting to the brokerage. The tuple is composed of the following elements:
    • host_ip_address::String: the IP address of the brokerage server
    • port::String: the port number of the brokerage server
    • username::String: the username to be used for the brokerage account
    • password::String: the password to be used for the brokerage account

Keywords

  • print_msg::Bool=false: whether or not to print messages to the console
source
TradingAgents.PLT_runMethod
PLT_run(num_traders::Int, num_assets::Int,
        parameters::Tuple{String, String, StepRangeLen{Float64}, StepRangeLen{Int}, Int, Int},
        server_info::Tuple{String, String};
        print_msg:Bool=false)

Simulate zero-intelligence liquidity takers in parallel. To operate these agents in parallel, the Distributed package is used. This function must be called after addprocs(n) has been called, where n is the number of workers to be used.

Arguments

  • num_traders::Int: the number of liquidity takers to simulate
  • num_assets::Int: the number of available assets for the agents to trade
  • parameters::Tuple{String, String, StepRangeLen{Float64}, StepRangeLen{Int}, Int, Int}: a tuple of parameters for the simulation. The tuple is composed of the following elements:
    • username::String: the username to be used for the brokerage account
    • password::String: the password to be used for the brokerage account
    • init_cash_range::StepRangeLen{Float64}: the range of initial cash values for the liquidity takers. E.g., init_cash_range = 10000.0:0.01:30000.0 defines a possible cash balance anywhere between $10,000.00 and $30,000.00.
    • init_shares_range::StepRangeLen{Int}: the range of initial share holdings for the liquidity takers. E.g., init_shares_range = 0:1:120 defines a possible share holding (of each available asset) anywhere between 0 shares and 120 shares.
    • trade_freq::Int: the average number of seconds between trades for each liquidity taker. E.g., trade_freq = 720 means that each liquidity taker will trade approximately once every 720 seconds (12 minutes).
    • num_MM::Int: the number of reserved ids set aside for non-brokerage users (e.g., market makers)
  • server_info::Tuple{String, String}: a tuple of server information for connecting to the brokerage. The tuple is composed of the following elements:
    • host_ip_address::String: the IP address of the brokerage server
    • port::String: the port number of the brokerage server

Keywords

  • print_msg::Bool=false: whether or not to print messages to the console
source
TradingAgents.PMM_runMethod
PMM_run(num_agents::Int, num_assets::Int,
        parameters::Tuple{Float64, Float64, Int, Int},
        server_info::Tuple{String, String, String, String};
        collect_data::Bool=false, print_msg::Bool=false)

Simulate random market-making agent activity in "parallel" (asynchronous tasks).

Arguments

  • num_agents::Int: the number of market-making agents to simulate
  • num_assets::Int: the number of available assets for the agents to trade
  • parameters::Tuple{Float64, Float64, Int, Int}: a tuple of parameters for the simulation. The tuple is composed of the following elements:
    • ϵ_min::Float64: the lower bound for the price deviation variable
    • ϵ_max::Float64: the upper bound for the price deviation variable
    • unit_trade_size::Int: the amount of shares behind each quote
    • trade_freq::Int: the average number of seconds between trades
  • server_info::Tuple{String, String, String, String}: a tuple of server information for connecting to the brokerage. The tuple is composed of the following elements:
    • host_ip_address::String: the IP address of the brokerage server
    • port::String: the port number of the brokerage server
    • username::String: the agent username for the brokerage server
    • password::String: the agent password for the brokerage server

Keywords

  • collect_data::Bool=false: whether or not to collect data from the simulation
  • print_msg::Bool=false: whether or not to print messages during the simulation
source