Refactored types
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use pulse_wire::terminal::ActivePosition;
|
||||
use pulse_wire::general::Position;
|
||||
use tokio::{sync::Mutex, task::JoinHandle};
|
||||
|
||||
use crate::{
|
||||
@@ -90,7 +90,7 @@ impl Engine {
|
||||
state
|
||||
.asset_positions
|
||||
.into_iter()
|
||||
.map(|position| ActivePosition {
|
||||
.map(|position| Position {
|
||||
symbol: position.position.coin,
|
||||
size: position.position.szi.as_f64(),
|
||||
entry_price: position
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use pulse_wire::terminal::WatchListItem;
|
||||
use pulse_wire::terminal::MarketItem;
|
||||
use serde_json::Value;
|
||||
|
||||
fn number(value: &Value, field: &str) -> Result<f64, String> {
|
||||
@@ -15,7 +15,7 @@ fn number(value: &Value, field: &str) -> Result<f64, String> {
|
||||
pub async fn fetch_watch_list(
|
||||
client: &hypersdk::hypercore::HttpClient,
|
||||
symbols: &[String],
|
||||
) -> Result<Vec<WatchListItem>, String> {
|
||||
) -> Result<Vec<MarketItem>, String> {
|
||||
let response = client
|
||||
.meta_and_asset_ctxs(None)
|
||||
.await
|
||||
@@ -63,7 +63,7 @@ pub async fn fetch_watch_list(
|
||||
|
||||
by_symbol.insert(
|
||||
symbol,
|
||||
WatchListItem {
|
||||
MarketItem {
|
||||
symbol: symbol.to_owned(),
|
||||
price,
|
||||
trend: ((price / previous_day_price) - 1.0) * 100.0,
|
||||
|
||||
@@ -3,10 +3,7 @@ use std::{
|
||||
sync::{Arc, Weak},
|
||||
};
|
||||
|
||||
use pulse_wire::{
|
||||
PulseWire,
|
||||
terminal::{EventLog, LogKind, TerminalClientMessage},
|
||||
};
|
||||
use pulse_wire::{PulseWire, general::{EventLog, LogKind}, terminal::TerminalClientMessage};
|
||||
use tokio::{
|
||||
io::{AsyncReadExt, AsyncWriteExt},
|
||||
net::{
|
||||
|
||||
Reference in New Issue
Block a user