Domain model

Tradeb0t operates with specific domain model in order to provide a unified way to work with different exchanges and assets.

Tradeb0t stores information only about one account, because it is designed to be used by one person.

Assets

Information about assets is stored in the memory, because this information required only if it is fresh. Also, application does not use disk resources to write and read this information.

classDiagram
class AssetBalance {
    +assetTicker: string
    +asset: Asset
    +amount: number
    +updatedAt: Date
}
class Asset {
    +ticker: string
    +name: string
    +balance: AssetBalance       
    +updatedAt: Date
}
AssetBalance <|-- SecurityBalance
class SecurityBalance {
    +asset: Security
}
Asset <|-- Security
class Security {
    +price: number
    +currency: Currency
    +currencyTicker: string      
    +balance: SecurityBalance    
    +isFollowed: boolean
}
AssetBalance <|-- CurrencyBalance
class CurrencyBalance {
    +asset: Currency
}
Asset <|-- Currency
class Currency {
    +exchangeTicker?: string | undefined
    +securities: Security[]
    +balance: CurrencyBalance
}
AssetBalance ..> "1" Asset
Asset ..> "1" AssetBalance
SecurityBalance ..> "1" Security
Security ..> "1" Currency
Security ..> "1" SecurityBalance
CurrencyBalance ..> "1" Currency
Currency ..> "*" Security
Currency ..> "1" CurrencyBalance
Mermaid diagram is loading...

Algorithms

Information about algorithms is persistanly stored in the SQLite file, because it should be available between sessions.

classDiagram
class Order {
    +exchangeId: string
    +securityTicker: string
    +status: OrderStatus
    +operation: "undefined" | "limit_buy" | "limit_sell" | "market_buy" | "market_sell" | "buy_or_cancel" | 
"sell_or_cancel"
    +lots: number
    +price: number
    +updatedAt?: Date | undefined
    +algorithmRunId?: number | undefined
    +algorithmRun?: AlgorithmRun<any, any> | undefined
}
class AlgorithmRun~InputType, StateType~ {
    +id: number
    +algorithmName: string
    +inputs: InputType
    +status: AlgorithmRunStatus
    +state: StateType
    +updatedAt: Date
    +createdAt: Date
    +algorithm: Algorithm
    +orders: Order[]
}
class Algorithm {
    +name: string
    +description: string
    +inputTypes: InputTypes
    +algorithmRuns?: AlgorithmRun<any, any>[] | undefined
}
Order ..> "1" AlgorithmRun
AlgorithmRun ..> "1" Algorithm
AlgorithmRun ..> "*" Order
Algorithm ..> "1" AlgorithmRun
Mermaid diagram is loading...