asmodehn / crypy

MIT License
2 stars 1 forks source link

crypy

Design

We adopt here the stream/dataflow point of view, between "agents", to be more easily parallelisable and resilient, yet humanly manageable.

Each of the parts can be viewed as an "actor", spinning at a specified frequency, communicating with others over streams with a specific API/protocol/language. Yet we attempt to instill whats needed for some "distributed automated learning"

The code can be written in sync (entity component system) or async (trio) style, but beware of traps when trying to mix the two styles. Interfaces should probably be streams of events ( see Scott Wlaschin talk and Whitesnake for references)

One important thing is that each of these must have a terminal/telnet interface, so that a human can dynamically configure its behavior, via a specific set of commands / programming language. This needs to be a different interface than the streaming one for dataflow. We will call it the controlflow.

Another dimension is the logic relationships: the code required is interchangeable, managed via plugins/extensions. same for technical indicators, strategies, etc. Their relationships are not related with the dataflow or the controlflow. If we consider the relationship between agents, it is alike "same logic" "same set of dependencies", or "different dependencies". It can be consider alike a "deployment strategy", or a logicflow.

The timeframes between the controlflow, the dataflow, and the logicflow are quite different. dataflow is high frequency data moving around. controlflow is human speed : seeing what is happening on the system at a speed acceptable for humans, in a way that human can adjust it. logicflow is very low frequency of change, akin to a doing a deployment of a software with different constraints/configuration/machine Note : all this is about relationships between actors, not about the code "inside" an actor.

Data concepts

We should rely on proper types, to ease eventual adaptability with other programming languages. For python we rely on panda dataframes.

They are transmitted over streams, as events, chunk by chunk, with specific resolution... TBD.

Basic Custom types used in code (think Domain Driven Design) :

Control Concepts

Note : holders and traders are created from templates, that a human controller can modify, to be used on next desk iteration. System needs to learn from failed strategies, failed positions, etc.

Logic Concepts

Interface Concepts

MVP :

Initial Configuration : 1 desk, 1 holder (trusted value as capital), 1 trader (moving average)