QA_Account

Struct QA_Account 

Source
pub struct QA_Account {
Show 14 fields pub events: HashMap<String, String>, pub accounts: account, pub cash: Vec<f64>, pub money: f64, pub trades: HashMap<String, QATransaction>, pub hold: HashMap<String, QA_Postions>, pub frozen: HashMap<String, QA_Frozen>, pub dailyassets: HashMap<String, QAAccountSlice>, pub history: Vec<QATransaction>, pub account_cookie: String, pub portfolio_cookie: String, pub user_cookie: String, pub dailytrades: BTreeMap<String, Trade>, pub dailyorders: BTreeMap<String, Order>, /* private fields */
}

Fields§

§events: HashMap<String, String>§accounts: account§cash: Vec<f64>§money: f64§trades: HashMap<String, QATransaction>§hold: HashMap<String, QA_Postions>§frozen: HashMap<String, QA_Frozen>§dailyassets: HashMap<String, QAAccountSlice>§history: Vec<QATransaction>§account_cookie: String§portfolio_cookie: String§user_cookie: String§dailytrades: BTreeMap<String, Trade>§dailyorders: BTreeMap<String, Order>

Implementations§

Source§

impl QA_Account

Source

pub fn new( account_cookie: &str, portfolio_cookie: &str, user_cookie: &str, init_cash: f64, auto_reload: bool, environment: &str, ) -> Self

Source

pub fn set_portfoliocookie(&mut self, portfolio: String)

Source

pub fn new_from_qifi(message: QIFI) -> Self

Source

pub fn init_h(&mut self, code: &str)

Source

pub fn reload(&mut self)

Source

pub fn get_cash(&mut self) -> f64

Source

pub fn get_riskratio(&mut self) -> f64

Source

pub fn get_mom_slice(&mut self) -> QAMOMSlice

Source

pub fn get_qifi_slice(&mut self) -> QIFI

创建QIFI的账户切片, 注意他是一个结构体

Source

pub fn get_accountmessage(&mut self) -> Account

Source

pub fn get_position(&mut self, code: &str) -> Option<&mut QA_Postions>

positions about

a fast way to get the realtime price/cost/volume/history

Source

pub fn get_volume_long(&mut self, code: &str) -> f64

Source

pub fn get_volume_short(&mut self, code: &str) -> f64

Source

pub fn get_open_price_long(&mut self, code: &str) -> f64

Source

pub fn get_open_price_short(&mut self, code: &str) -> f64

Source

pub fn get_frozen(&mut self, code: &str) -> f64

frozen & margin

Source

pub fn get_margin(&mut self) -> f64

Source

pub fn get_floatprofit(&mut self) -> f64

profit

Source

pub fn get_positionprofit(&mut self) -> f64

Source

pub fn get_balance(&mut self) -> f64

balance

Source

pub async fn settle_async(&mut self)

Source

pub fn settle(&mut self)

Source

pub fn get_codeSubscribed(&mut self) -> Vec<String>

Source

pub fn get_slice(&mut self) -> QAAccountSlice

Source

pub fn get_account_info(&mut self) -> account_info

Source

pub fn get_latest_info(&mut self) -> String

Source

pub fn history_table(&self)

history about

Source

pub fn to_csv(&self) -> Result<(), Box<dyn Error>>

Source

pub fn buy( &mut self, code: &str, amount: f64, time: &str, price: f64, ) -> Result<QAOrder, ()>

order about buy| sell| buy_open| sell_open| buy_close| sell_close| send_order

Source

pub fn sell( &mut self, code: &str, amount: f64, time: &str, price: f64, ) -> Result<QAOrder, ()>

Source

pub fn buy_open( &mut self, code: &str, amount: f64, time: &str, price: f64, ) -> Result<QAOrder, ()>

Source

pub fn sell_open( &mut self, code: &str, amount: f64, time: &str, price: f64, ) -> Result<QAOrder, ()>

Source

pub fn buy_close( &mut self, code: &str, amount: f64, time: &str, price: f64, ) -> Result<QAOrder, ()>

Source

pub fn sell_close( &mut self, code: &str, amount: f64, time: &str, price: f64, ) -> Result<QAOrder, ()>

Source

pub fn buy_closetoday( &mut self, code: &str, amount: f64, time: &str, price: f64, ) -> Result<QAOrder, ()>

Source

pub fn sell_closetoday( &mut self, code: &str, amount: f64, time: &str, price: f64, ) -> Result<QAOrder, ()>

Source

pub fn get_tradingday(&mut self) -> String

Source

pub async fn send_order_async( &mut self, code: &str, amount: f64, time: &str, towards: i32, price: f64, order_id: &str, ) -> Option<QAOrder>

Source

pub fn send_order( &mut self, code: &str, amount: f64, time: &str, towards: i32, price: f64, order_id: &str, ) -> Result<QAOrder, ()>

Source

pub fn on_price_change(&mut self, code: String, price: f64, datetime: String)

Source

pub fn change_datetime(&mut self, datetime: String)

Source

pub fn set_init_cash(&mut self, cash: f64)

Source

pub fn get_direction_or_offset(&mut self, towards: i32) -> (String, String)

获取成交单方向信息的API, 支持股票与期货

Trait Implementations§

Source§

impl Clone for QA_Account

Source§

fn clone(&self) -> QA_Account

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for QA_Account

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V