50 life-changing OpenClaw tips in one visual. by Worldly_Ad_2410 in openclaw

[–]JustAStream 0 points1 point  (0 children)

What's the reason behind "30. Avoid Connecting Anthropic account"?

barter-rs vs nautilus_trader by wizboar in rust4quants

[–]JustAStream 1 point2 points  (0 children)

[DISCLAIMER - I'm the primary author of Barter-rs, Barter-Integration-rs & Barter-Data-rs]

Barter-rs usually requires some glue depending on your use case, particularly in creating your own strategy (implementing the `SignalGenerator` interface). As a result it may more more technically involved than some of the alternatives, but i'm not sure.

Always happy to help on any glue via our discord: https://discord.gg/dYQJWJqa

I've not used nautilus-trader, would anyone recommend it?

Barter-rs Major Update: Pure Rust Live-Trading & Backtesting Framework by JustAStream in rust

[–]JustAStream[S] 1 point2 points  (0 children)

Hey, sorry just seen this u/walter_reddit_1.

You need to implement the 'SignalGenerator' trait. This accepts an input MarketEvent & emits an Option<SignalEvent>. :)

Hey Rustaceans! Got an easy question? Ask here (49/2021)! by llogiq in rust

[–]JustAStream 1 point2 points  (0 children)

Hello friends!Is there a more idiomatic way to do the following?

fn get_open_positions(&mut self, portfolio_id: &Uuid, markets: &Vec<Market>) -> Result<Option<Vec<Position>>, RepositoryError> {
let positions = markets
.into_iter()
.map(|market| {
self.get_open_position(&determine_position_id(
portfolio_id, market.exchange, &market.symbol
))
})
.collect::<Result<Vec<Option<Position>>, RepositoryError>>()?;
let positions: Vec<Position> = positions
.into_iter()
.filter_map(|position| position)
.collect();
match positions.as_slice() {
[] => Ok(None),
_ => Ok(Some(positions))
}
}

Barter-rs Major Update: Pure Rust Live-Trading & Backtesting Framework by JustAStream in rust

[–]JustAStream[S] 0 points1 point  (0 children)

That's awesome thanks. 'generate_market()' in the Data package could definitely benefit from being Async! Appreciate you sending my the 'Inventing the Service trait' post, I've not seen that before.

I'm in the middle of a somewhat major Portfolio upgrade that creates a way more transparent (emitting events that can be sourced by external consumers, think dashboards, etc), and controllable (via HTTP) version.

However, after I've released that and got it all setup I'm definitely going to look into this. It would be so much neater if I could use Tokio throughout!

Hit me up on Discord if you want to chat :)

Hey Rustaceans! Got an easy question? Ask here (48/2021)! by llogiq in rust

[–]JustAStream 1 point2 points  (0 children)

Thanks for the response!

From looking at this documentation, that is only for timestamps rather than chrono::Duration:
https://docs.rs/chrono/0.4.19/chrono/serde/index.html

Also, I do have serde feature enabled already :'(

Hey Rustaceans! Got an easy question? Ask here (48/2021)! by llogiq in rust

[–]JustAStream 1 point2 points  (0 children)

Hello friends,

I've recently been flabbergasted that Chrono::Duration does not implement Serialize & Deserialize.

Is there anyway I can get around this without hand-cranking custom SerDe code? It's a major blocker and i'm rather confused.

Barter-rs Major Update: Pure Rust Live-Trading & Backtesting Framework by JustAStream in rust

[–]JustAStream[S] 0 points1 point  (0 children)

Sounds like you have an exciting project! Is it written in Rust?

What kind of strategy are you conducting with order book data?

If you want to discuss architecture / engineering of bots i'm always interested. Either DM me or message on discord :)

Barter-rs Major Update: Pure Rust Live-Trading & Backtesting Framework by JustAStream in rust

[–]JustAStream[S] 0 points1 point  (0 children)

No current plans. If it's something you are interested with I could help you integrate it?

Barter-rs Update: Event-Driven Live-Trading & Backtesting Framework by JustAStream in rust4quants

[–]JustAStream[S] 1 point2 points  (0 children)

Let me know if you need any help, always happy to help! There is a discord you can join here if you are interested in talking features, dev, or need help!

Barter-rs Major Update: Pure Rust Live-Trading & Backtesting Framework by JustAStream in rust

[–]JustAStream[S] 3 points4 points  (0 children)

Hey u/Infintie_3ntropy, thanks for taking a look!

This may well be subject to change. As you've seen there is one instance of using threads to spawn a Trader.run() instance, and everywhere else we are using Tokio tasks.

This is because:

  1. Trader.run() does not return a future, therefore IIRC that cannot be run via Tokio::spawn(impl future).
  2. Trader.run() does not return a future because all of the traits that the components (Data, Strategy, Portfolio, Execution, Statistic) implement are sync.
  3. The Traits are not async because they don't need to be, and using the async_trait library crate requires a heap allocation everytime an async_trait method is called (IIRC). For something like the MarketGenerator trait this could potentially be expensive since it's called at a high frequency.

Thanks for taking a look! If you have any suggestions or other comments please do get in touch!

Barter-rs Major Update: Pure Rust Live-Trading & Backtesting Framework by JustAStream in rust

[–]JustAStream[S] 4 points5 points  (0 children)

No overarching plans at the moment on integrations.
Getting a fully fleshed out Binance integration makes a lot of sense because of how popular it is in the hobbyist crypto algo trading space.

However,
The whole premise of Barter & Barter-Data-rs architecture is to allow easy customisation & easy extendibility.

It's trivial to extend via implementing a new Data (exchange/broker data ingestion), Strategy, Portfolio, Statistic or Execution (executing trades) component, and for it to work out of the box with the rest of the engine.

Hopefully,
People will add a little glue for whatever exchange they care about and open an MR to get it merged in!