lighter-rust 0.2.0

A comprehensive Rust SDK for the Lighter trading platform with async/await, WebSocket support, and Ethereum wallet integration
/*
 *
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document:
 *
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct PositionFunding {
    #[serde(rename = "timestamp")]
    pub timestamp: i64,
    #[serde(rename = "market_id")]
    pub market_id: i32,
    #[serde(rename = "funding_id")]
    pub funding_id: i64,
    #[serde(rename = "change")]
    pub change: String,
    #[serde(rename = "rate")]
    pub rate: String,
    #[serde(rename = "position_size")]
    pub position_size: String,
    #[serde(rename = "position_side")]
    pub position_side: PositionSide,
}

impl PositionFunding {
    pub fn new(
        timestamp: i64,
        market_id: i32,
        funding_id: i64,
        change: String,
        rate: String,
        position_size: String,
        position_side: PositionSide,
    ) -> PositionFunding {
        PositionFunding {
            timestamp,
            market_id,
            funding_id,
            change,
            rate,
            position_size,
            position_side,
        }
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum PositionSide {
    #[serde(rename = "long")]
    Long,
    #[serde(rename = "short")]
    Short,
}

impl Default for PositionSide {
    fn default() -> PositionSide {
        Self::Long
    }
}