90 lines
3.0 KiB
Rust
90 lines
3.0 KiB
Rust
pub mod strategy_001;
|
|
pub mod strategy_002;
|
|
pub mod strategy_003;
|
|
pub mod strategy_004;
|
|
pub mod strategy_005;
|
|
pub mod strategy_006;
|
|
pub mod strategy_test;
|
|
pub mod strategy_manager;
|
|
|
|
use crate::coex::order_team::{limit_order_sell, select_filled_buy_orders};
|
|
use crate::coin_health_check_team::request_others::{ExchangeInfo, TradeFee};
|
|
use crate::database_control::*;
|
|
use crate::decimal_funcs::*;
|
|
use crate::value_estimation_team::datapoints::price_data::RealtimePriceData;
|
|
use crate::value_estimation_team::indicators::bollingerband::{bollingerband, BollingerBandData};
|
|
use crate::value_estimation_team::indicators::ema::{ema, EmaData};
|
|
use crate::value_estimation_team::indicators::heatmap_volume::{
|
|
heatmap_volume, HeatMapLevel, HeatmapVolumeData,
|
|
};
|
|
use crate::value_estimation_team::indicators::macd::{ema_macd, EmaMacd};
|
|
use crate::value_estimation_team::indicators::rsi::{rsi, RsiData};
|
|
use crate::value_estimation_team::indicators::sma::{sma, SmaData};
|
|
use crate::value_estimation_team::indicators::stoch_rsi::{stoch_rsi, StochRsiData};
|
|
use crate::value_estimation_team::indicators::supertrend::{supertrend, SupertrendData};
|
|
use crate::value_estimation_team::indicators::adx::{AdxData, adx};
|
|
use futures::future::try_join_all;
|
|
use reqwest::{Client, ClientBuilder};
|
|
use rust_decimal::{prelude::FromPrimitive, prelude::ToPrimitive, Decimal, RoundingStrategy};
|
|
use rust_decimal_macros::dec;
|
|
use sqlx::FromRow;
|
|
use std::sync::Arc;
|
|
use strategy_manager::insert_pre_suggested_coins;
|
|
use tokio::sync::Mutex;
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub struct AllData {
|
|
pub valid_symbol_vec: Vec<String>,
|
|
pub rt_price_1m_vec: Vec<(String, Vec<RealtimePriceData>)>,
|
|
pub rt_price_30m_vec: Vec<(String, Vec<RealtimePriceData>)>,
|
|
pub rt_price_1d_vec: Vec<(String, Vec<RealtimePriceData>)>,
|
|
pub rt_price_1w_vec: Vec<(String, Vec<RealtimePriceData>)>,
|
|
pub rt_price_1mon_vec: Vec<(String, Vec<RealtimePriceData>)>,
|
|
}
|
|
impl AllData {
|
|
pub fn new() -> AllData {
|
|
let a = AllData {
|
|
valid_symbol_vec: Vec::new(),
|
|
rt_price_1m_vec: Vec::new(),
|
|
rt_price_30m_vec: Vec::new(),
|
|
rt_price_1d_vec: Vec::new(),
|
|
rt_price_1w_vec: Vec::new(),
|
|
rt_price_1mon_vec: Vec::new(),
|
|
};
|
|
a
|
|
}
|
|
}
|
|
|
|
#[derive(Debug, FromRow)]
|
|
pub struct TimeData {
|
|
pub server_epoch: u64,
|
|
pub local_epoch: u64,
|
|
pub epoch_difference: i64,
|
|
pub server_ymdhs: String,
|
|
pub local_ymdhs: String,
|
|
pub last_server_epoch: u64,
|
|
pub last_server_ymdhs: String,
|
|
}
|
|
|
|
#[derive(Clone)]
|
|
pub struct FilteredData {
|
|
pub symbol: String,
|
|
pub closetime: i64,
|
|
pub stoploss: Decimal,
|
|
pub target_price: Decimal,
|
|
pub current_price: Decimal,
|
|
}
|
|
|
|
impl FilteredData {
|
|
fn new() -> FilteredData {
|
|
let a = FilteredData {
|
|
symbol: String::new(),
|
|
closetime: 0,
|
|
stoploss: Decimal::new(0, 8),
|
|
target_price: Decimal::new(0, 8),
|
|
current_price: Decimal::new(0, 8),
|
|
};
|
|
a
|
|
}
|
|
}
|