abstract public class Simulator extends Env
plham.main.Runner
for execution models.
See the subclass plham.Main
for the core methods.Env.MarketsFlat
Modifier and Type | Field and Description |
---|---|
JSON.Value |
CONFIG
The JSON config file.
|
Map<String,Any> |
GLOBAL
It stores the return values of
createMarkets() , createAgents() , and createEvents() . |
Random |
RANDOM
The root of all instances of Random.
|
DEBUG, agents, hifreqAgents, localAgents, markets, marketsF, normalAgents, orders
Constructor and Description |
---|
Simulator() |
Modifier and Type | Method and Description |
---|---|
abstract void |
beginSession(String sessionName) |
abstract void |
beginSimulation() |
abstract List<Agent> |
createAgents(JSON.Value json) |
List<Agent> |
createAllAgents(JSON.Value list) |
List<Event> |
createAllEvents(JSON.Value list) |
List<Market> |
createAllMarkets(JSON.Value list) |
abstract List<Event> |
createEvents(JSON.Value json) |
Fundamentals |
createFundamentals(List<Market> markets,
JSON.Value json)
Create an instance of Fundamentals based on the JSON object.
|
protected <T> List<T> |
createItemGroup(JSON.Value json,
String className,
String keyword)
For the item grouping technology based on the idea of
keyword chainin JSON. |
abstract List<Market> |
createMarkets(JSON.Value json) |
abstract void |
endSession(String sessionName) |
abstract void |
endSimulation() |
<T> T |
getItemByName(JSON.Value json)
Get an item (instance) stored in GLOBAL by the name.
|
<T> T |
getItemByName(String name)
Get an item (instance) stored in GLOBAL by the name.
|
<T> List<T> |
getItemsByName(JSON.Value json)
Get a list of items (instances) stored in GLOBAL specified by the list of names.
|
<T> List<T> |
getItemsByName(String name)
Get a list of items (instances) stored in GLOBAL by the name.
|
<T> List<T> |
getItemsByName(Fun_0_1 <Long,String> names,
Long n)
Declaration: getItemsByName[T](names:(Long)=>String, n:Long):List[T].
Get a list of items (instances) stored in GLOBAL specified by the list of names.
|
Random |
getRandom()
Get the root of all instances of Random (allowed to call only at the place 0).
|
abstract void |
print(String sessionName) |
void |
updateFundamentals(Fundamentals f)
For system use only.
|
void |
updateMarketsUsingFundamentalPrice(List<Market> markets,
Fundamentals fundamentals)
For system use only.
|
void |
updateMarketsUsingMarketPrice(List<Market> markets,
Fundamentals fundamentals)
For system use only.
|
addOrders, getenvOrElse, initMarketsF, prepareMarketsF, receiveMarketsF
public Map<String,Any> GLOBAL
createMarkets()
, createAgents()
, and createEvents()
.public JSON.Value CONFIG
public Random RANDOM
public Random getRandom()
public abstract void beginSimulation()
public abstract void endSimulation()
public abstract void beginSession(String sessionName)
public abstract void endSession(String sessionName)
public abstract void print(String sessionName)
protected <T> List<T> createItemGroup(JSON.Value json, String className, String keyword)
keyword chainin JSON.
json
- className
- a dummy class name, e.g., "AgentGroup"keyword
- a name for keyword chain, e.g., "agents"public List<Market> createAllMarkets(JSON.Value list)
public abstract List<Market> createMarkets(JSON.Value json)
public List<Agent> createAllAgents(JSON.Value list)
public abstract List<Agent> createAgents(JSON.Value json)
public List<Event> createAllEvents(JSON.Value list)
public abstract List<Event> createEvents(JSON.Value json)
public Fundamentals createFundamentals(List<Market> markets, JSON.Value json)
markets
- json
- a JSON object, or properties of correlations of fundamentalspublic void updateFundamentals(Fundamentals f)
public void updateMarketsUsingFundamentalPrice(List<Market> markets, Fundamentals fundamentals)
public void updateMarketsUsingMarketPrice(List<Market> markets, Fundamentals fundamentals)
public <T> List<T> getItemsByName(String name)
name
- a section name defined in the JSON config file.public <T> T getItemByName(String name)
List
, the size must be 1.
This throws an exception if the size is > 1.name
- a section name defined in the JSON config file.public <T> List<T> getItemsByName(Fun_0_1 <Long,String> names, Long n)
Get a list of items (instances) stored in GLOBAL specified by the list of names.
names
- section names defined in the JSON config file.n
- the length of names.public <T> List<T> getItemsByName(JSON.Value json)
json
- section name(s) (String or List) defined in the JSON config file.public <T> T getItemByName(JSON.Value json)
List
, the size must be 1.
This throws an exception if the size is > 1.json
- a section name (String or List) defined in the JSON config file.