Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Derive clone for TradingEnvironment #5

Open
matteosantama opened this issue Jan 4, 2024 · 1 comment
Open

Derive clone for TradingEnvironment #5

matteosantama opened this issue Jan 4, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@matteosantama
Copy link
Contributor

I hope you don't mind me throwing some issues at you. If I collect enough of them and they start to become urgent I'll open a PR myself.

Another quality-of-life improvement would be to make TradingEnvironment Clone. Consider

fn run(env: TradingEnvironment) {
    let mut kalshi = Kalshi::new(env); // <- env is consumed here
    ...
    // so I can't use it later, like this
    if env == TradingEnvironment::Demo { 
        ....
    }
}

Currently, I have to manually clone it by adding

let env_clone = match &env {
    TradingEnvironment::DemoMode => TradingEnvironment::DemoMode,
    TradingEnvironment::LiveMarketMode => TradingEnvironment::LiveMarketMode,
};
@dpeachpeach dpeachpeach added the enhancement New feature or request label Jan 4, 2024
@dpeachpeach
Copy link
Owner

Yep! Strong suggestion and should be a quick implementation, I'll work on this :)

@dpeachpeach dpeachpeach self-assigned this Jan 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants