add: StockVal
- change 'numeric' to 'bigint' in 002_table_stock - add StockVal file - add mod.rs file for ds/generic - use StockVal and Company in global_state.rs - make application buildable
This commit is contained in:
parent
cb8a6ce2aa
commit
e476538035
|
@ -2,7 +2,7 @@ use libtrader::initializer::libtrader_init;
|
|||
|
||||
fn main() {
|
||||
match libtrader_init() {
|
||||
Ok(()) => println!("connected successfully"),
|
||||
Ok(state) => println!("inited state: {:?}", state),
|
||||
Err(err) => println!("Failed with error: {}", err),
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ CREATE TABLE asset_schema.stock_vals (
|
|||
id BIGSERIAL PRIMARY KEY,
|
||||
isin text NOT NULL,
|
||||
time_since_epoch timestamp NOT NULL,
|
||||
ask_price numeric NOT NULL,
|
||||
bid_price numeric NOT NULL,
|
||||
ask_price bigint NOT NULL,
|
||||
bid_price bigint NOT NULL,
|
||||
volume bigint NOT NULL
|
||||
)
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#[derive(Default, PartialEq, Debug)]
|
||||
pub struct Company {
|
||||
pub id: u8,
|
||||
pub symbol: String,
|
||||
|
|
2
src/libtrader/ds/generic/mod.rs
Normal file
2
src/libtrader/ds/generic/mod.rs
Normal file
|
@ -0,0 +1,2 @@
|
|||
pub mod company;
|
||||
pub mod stock_val;
|
9
src/libtrader/ds/generic/stock_val.rs
Normal file
9
src/libtrader/ds/generic/stock_val.rs
Normal file
|
@ -0,0 +1,9 @@
|
|||
#[derive(Default, PartialEq, Debug)]
|
||||
pub struct StockVal {
|
||||
pub id: u8,
|
||||
pub isin: String,
|
||||
pub time_since_epoch: i128,
|
||||
pub ask_price: i8,
|
||||
pub bid_price: i8,
|
||||
pub volume: i8
|
||||
}
|
|
@ -1,3 +1,4 @@
|
|||
pub mod generic;
|
||||
pub mod account;
|
||||
pub mod server;
|
||||
pub mod message;
|
||||
|
|
|
@ -5,6 +5,9 @@ use crate::ds::server::master_state::MasterState;
|
|||
#[allow(unused_imports)]
|
||||
use crate::ds::server::worker_state::WorkerState;
|
||||
|
||||
use crate::ds::generic::company::Company;
|
||||
use crate::ds::generic::stock_val::StockVal;
|
||||
|
||||
#[derive(Default, PartialEq, Debug)]
|
||||
pub struct GlobalState {
|
||||
#[cfg(feature="master_server")]
|
||||
|
@ -12,6 +15,6 @@ pub struct GlobalState {
|
|||
#[cfg(feature="worker_server")]
|
||||
pub state: WorkerState,
|
||||
|
||||
pub companies: HashMap<String, Companies>,
|
||||
pub companies: HashMap<String, Company>,
|
||||
pub stock_vals: HashMap<String, StockVal>,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user