forked from wzrdsappr/trading-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
trading-core.lisp
45 lines (30 loc) · 1.43 KB
/
trading-core.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
;;;; trading-core.lisp
(in-package #:trading-core)
;; Global constants
(defconstant +epsilon+ single-float-epsilon)
;; Global parameters
(defparameter *agents* '()
"List of agents producing useful effects (processing events to produce other events)
or applying various trading strategies")
(defparameter *aggregate-agents* '()
"List of agents that aggregate other agent (agents trading againsts a portfolio
of securities or agents trading multiple strategies against a single security).
These agents are in a separate list since the need to be updated after all of
their child agents have been updated.")
(defparameter *events-queue* '()
"Chronological list of events (security prices or communications from other agents)
to be processed by the agents.")
;; API methods
(defgeneric update (agent event)
(:documentation "Main method used to process events of various types."))
(defgeneric observe (agent event)
(:documentation "Determine if a particular event is relevent to the specified agent."))
(defgeneric emit (agent msg &optional comm-type)
(:documentation "Add an event to the event queue for other agents to (optionally) process."))
(defgeneric preprocess (agent event)
(:documentation "Do prerequisite calculations needed by the update method."))
(defgeneric postprocess (agent event)
(:documentation "Perform any required cleanup/procesing required after the update method has run."))
; load-event-data
; run-simulation
;; EOF