File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -75,8 +75,7 @@ pub async fn deposit_money(
7575
7676 // Update user balance
7777 let mut user_active_model: users:: ActiveModel = user. into ( ) ;
78- user_active_model. wallet_balance =
79- Set ( RustDecimal :: try_from ( balance_after) . unwrap ( ) ) ;
78+ user_active_model. wallet_balance = Set ( RustDecimal :: try_from ( balance_after) . unwrap ( ) ) ;
8079 user_active_model. updated_at = Set ( chrono:: Utc :: now ( ) . naive_utc ( ) ) ;
8180
8281 let _updated_user = user_active_model. update ( & txn) . await . map_err ( |e| {
@@ -219,8 +218,7 @@ pub async fn withdraw_money(
219218
220219 // Update user balance
221220 let mut user_active_model: users:: ActiveModel = user. into ( ) ;
222- user_active_model. wallet_balance =
223- Set ( RustDecimal :: try_from ( balance_after) . unwrap ( ) ) ;
221+ user_active_model. wallet_balance = Set ( RustDecimal :: try_from ( balance_after) . unwrap ( ) ) ;
224222 user_active_model. updated_at = Set ( chrono:: Utc :: now ( ) . naive_utc ( ) ) ;
225223
226224 let _updated_user = user_active_model. update ( & txn) . await . map_err ( |e| {
Original file line number Diff line number Diff line change @@ -48,11 +48,10 @@ impl OrderBookEngine {
4848 }
4949
5050 // For Fill-Or-Kill orders, check if we can fill the entire order
51- if order. time_in_force == TimeInForce :: FOK
52- && !self . can_fill_entire_order ( & order) {
53- order. reject ( ) ;
54- return Ok ( vec ! [ ] ) ;
55- }
51+ if order. time_in_force == TimeInForce :: FOK && !self . can_fill_entire_order ( & order) {
52+ order. reject ( ) ;
53+ return Ok ( vec ! [ ] ) ;
54+ }
5655
5756 // Market orders get the best available price
5857 let trades = if order. order_type == OrderType :: Market {
Original file line number Diff line number Diff line change @@ -210,10 +210,7 @@ impl PositionTracker {
210210
211211 let mut grouped: HashMap < i32 , Vec < UserPosition > > = HashMap :: new ( ) ;
212212 for position in positions {
213- grouped
214- . entry ( position. event_id )
215- . or_default ( )
216- . push ( position) ;
213+ grouped. entry ( position. event_id ) . or_default ( ) . push ( position) ;
217214 }
218215
219216 Ok ( grouped)
Original file line number Diff line number Diff line change @@ -394,7 +394,6 @@ impl WebSocketHandlers {
394394 pub async fn fetch_and_broadcast_portfolio ( & self , user_id : i32 ) {
395395 // Import position tracker
396396 use crate :: order_book:: position_tracker:: PositionTracker ;
397-
398397
399398 // Get user data
400399 let user = match users:: Entity :: find_by_id ( user_id)
@@ -633,7 +632,6 @@ impl WebSocketHandlers {
633632 }
634633}
635634
636-
637635impl Default for PaginationQuery {
638636 fn default ( ) -> Self {
639637 Self {
Original file line number Diff line number Diff line change @@ -27,7 +27,6 @@ pub struct WebSocketServer {
2727 redis_pool : Option < web:: Data < Pool > > ,
2828}
2929
30-
3130impl WebSocketServer {
3231 pub fn with_handlers ( db : web:: Data < DatabaseConnection > , redis_pool : web:: Data < Pool > ) -> Self {
3332 Self {
You can’t perform that action at this time.
0 commit comments