Comments (2)
@JoshuaBatty it is NOT implemented. The request is different, so you will need:
- Update websockets.rs and add a new subscribe method:
pub fn subscribe_raw_books<S>(&mut self, symbol: S, et: EventType)
where S: Into<String>
{
let msg = json!(
{
"event": "subscribe",
"channel": "book",
"pair": self.format_symbol(symbol.into(), et),
"prec": "R0"
});
if let Err(error_msg) = self.sender.send(&msg.to_string()) {
self.error_hander(error_msg);
}
}
Note: The algorithm for raw books is based on "R0", so I guess we can hardcode it.
- Add a new struct to book.rs as it streams order_id, price and amount
// Trading: if AMOUNT > 0 then bid else ask; Funding: if AMOUNT < 0 then bid else ask;
#[derive(Serialize, Deserialize, Debug)]
pub struct RawBook {
pub order_id: i64,
pub price: f64,
pub amount: f64,
}
- Update events.rs and add 2 new entries to the Enum DataEvent
RawBookEvent (i32, RawBook),
RawBookUpdateEvent (i32, Vec<RawBook>),
- In order to test, update on_data_event in public_channels.rs to handle the Event and UpdateEvent added above ...
} else if let DataEvent::RawBookEvent(channel, raw_book) = event {
println!("Rawbook Event ({}) - {:?}", channel, raw_book);
} ....
Please submit a Pull Request if it works, together with any other changes, so we can add it to the library.
from bitfinex-rs.
@wisespace-io thanks a bunch this works great. Had to change the order of the json message to subscribe but after that everything works perfectly. I've opened a pull request so feel free to merge when you're ready.
from bitfinex-rs.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bitfinex-rs.