Skip to content

Commit 0bf9a78

Browse files
committed
added some things
1 parent 78e5693 commit 0bf9a78

File tree

5 files changed

+35
-6
lines changed

5 files changed

+35
-6
lines changed

crates/binary_options_tools/errors.log

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,3 +518,18 @@
518518
[{"chart_id":"chart-1","settings":"{\"chartId\":\"chart-1\",\"chartType\":2,\"chartPeriod\":12,\"candlesTimer\":true,\"symbol\":\"#AAPL_otc\",\"demoDealAmount\":10,\"liveDealAmount\":1,\"enabledTradeMonitor\":false,\"enabledRatingWidget\":true,\"isVisible\":true,\"fastTimeframe\":300,\"enabledAutoscroll\":true,\"enabledGridSnap\":true,\"minimizedTradePanel\":false,\"fastCloseAt\":1736879441,\"enableQuickAutoOffset\":false,\"quickAutoOffsetValue\":120,\"showArea\":true,\"percentAmount\":1}"}], parsing it as raw data
519519
2025-06-27T21:30:34.194127Z WARN binary_options_tools::pocketoption::parser::message: Failed to parse message of type 'successupdateBalance':
520520
[{"chart_id":"chart-1","settings":"{\"chartId\":\"chart-1\",\"chartType\":2,\"chartPeriod\":12,\"candlesTimer\":true,\"symbol\":\"#AAPL_otc\",\"demoDealAmount\":10,\"liveDealAmount\":1,\"enabledTradeMonitor\":false,\"enabledRatingWidget\":true,\"isVisible\":true,\"fastTimeframe\":300,\"enabledAutoscroll\":true,\"enabledGridSnap\":true,\"minimizedTradePanel\":false,\"fastCloseAt\":1736879441,\"enableQuickAutoOffset\":false,\"quickAutoOffsetValue\":120,\"showArea\":true,\"percentAmount\":1}"}], parsing it as raw data
521+
2025-06-28T02:27:50.218165Z WARN binary_options_tools::pocketoption::parser::message: Failed to parse message of type 'successupdateBalance':
522+
[{"chart_id":"chart-1","settings":"{\"chartId\":\"chart-1\",\"chartType\":2,\"chartPeriod\":12,\"candlesTimer\":true,\"symbol\":\"#AAPL_otc\",\"demoDealAmount\":10,\"liveDealAmount\":1,\"enabledTradeMonitor\":false,\"enabledRatingWidget\":true,\"isVisible\":true,\"fastTimeframe\":300,\"enabledAutoscroll\":true,\"enabledGridSnap\":true,\"minimizedTradePanel\":false,\"fastCloseAt\":1736879441,\"enableQuickAutoOffset\":false,\"quickAutoOffsetValue\":120,\"showArea\":true,\"percentAmount\":1}"}], parsing it as raw data
523+
2025-06-28T02:31:53.678769Z WARN binary_options_tools::pocketoption::parser::message: Failed to parse message of type 'successupdateBalance':
524+
[{"chart_id":"chart-1","settings":"{\"chartId\":\"chart-1\",\"chartType\":2,\"chartPeriod\":12,\"candlesTimer\":true,\"symbol\":\"#AAPL_otc\",\"demoDealAmount\":10,\"liveDealAmount\":1,\"enabledTradeMonitor\":false,\"enabledRatingWidget\":true,\"isVisible\":true,\"fastTimeframe\":300,\"enabledAutoscroll\":true,\"enabledGridSnap\":true,\"minimizedTradePanel\":false,\"fastCloseAt\":1736879441,\"enableQuickAutoOffset\":false,\"quickAutoOffsetValue\":120,\"showArea\":true,\"percentAmount\":1}"}], parsing it as raw data
525+
2025-06-28T02:34:27.020396Z WARN binary_options_tools_core::general::client: Error in event loop, Websocket connection was closed by the server, Recieved closing frame, reconnecting...
526+
2025-06-28T02:34:28.970798Z WARN binary_options_tools::pocketoption::parser::message: Failed to parse message of type 'updateOpenedDeals':
527+
[{"chart_id":"chart-1","settings":"{\"chartId\":\"chart-1\",\"chartType\":2,\"chartPeriod\":12,\"candlesTimer\":true,\"symbol\":\"#AAPL_otc\",\"demoDealAmount\":10,\"liveDealAmount\":1,\"enabledTradeMonitor\":false,\"enabledRatingWidget\":true,\"isVisible\":true,\"fastTimeframe\":300,\"enabledAutoscroll\":true,\"enabledGridSnap\":true,\"minimizedTradePanel\":false,\"fastCloseAt\":1736879441,\"enableQuickAutoOffset\":false,\"quickAutoOffsetValue\":120,\"showArea\":true,\"percentAmount\":1}"}], parsing it as raw data
528+
2025-06-28T02:37:27.102821Z WARN binary_options_tools_core::general::client: Error in event loop, Websocket connection was closed by the server, Recieved closing frame, reconnecting...
529+
2025-06-28T02:37:29.048330Z WARN binary_options_tools::pocketoption::parser::message: Failed to parse message of type 'updateOpenedDeals':
530+
[{"chart_id":"chart-1","settings":"{\"chartId\":\"chart-1\",\"chartType\":2,\"chartPeriod\":12,\"candlesTimer\":true,\"symbol\":\"#AAPL_otc\",\"demoDealAmount\":10,\"liveDealAmount\":1,\"enabledTradeMonitor\":false,\"enabledRatingWidget\":true,\"isVisible\":true,\"fastTimeframe\":300,\"enabledAutoscroll\":true,\"enabledGridSnap\":true,\"minimizedTradePanel\":false,\"fastCloseAt\":1736879441,\"enableQuickAutoOffset\":false,\"quickAutoOffsetValue\":120,\"showArea\":true,\"percentAmount\":1}"}], parsing it as raw data
531+
2025-06-28T02:40:27.147444Z WARN binary_options_tools_core::general::client: Error in event loop, Websocket connection was closed by the server, Recieved closing frame, reconnecting...
532+
2025-06-28T02:40:29.089754Z WARN binary_options_tools::pocketoption::parser::message: Failed to parse message of type 'successupdateBalance':
533+
[{"chart_id":"chart-1","settings":"{\"chartId\":\"chart-1\",\"chartType\":2,\"chartPeriod\":12,\"candlesTimer\":true,\"symbol\":\"#AAPL_otc\",\"demoDealAmount\":10,\"liveDealAmount\":1,\"enabledTradeMonitor\":false,\"enabledRatingWidget\":true,\"isVisible\":true,\"fastTimeframe\":300,\"enabledAutoscroll\":true,\"enabledGridSnap\":true,\"minimizedTradePanel\":false,\"fastCloseAt\":1736879441,\"enableQuickAutoOffset\":false,\"quickAutoOffsetValue\":120,\"showArea\":true,\"percentAmount\":1}"}], parsing it as raw data
534+
2025-06-28T02:43:27.230194Z WARN binary_options_tools_core::general::client: Error in event loop, Websocket connection was closed by the server, Recieved closing frame, reconnecting...
535+
2025-06-28T02:43:50.303227Z ERROR EventLoop: Error calling callback, Failed to execute 'SubscribeSymbolCallback' task before the maximum allowed time of '16s'

crates/binary_options_tools/src/pocketoption/parser/message.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ pub enum WebSocketMessage {
4242

4343
LoadHistoryPeriod(LoadHistoryPeriodResult),
4444
UpdateStream(UpdateStream),
45+
UpdateHistoryNew(UpdateHistoryNewFast),
46+
4547
UpdateHistoryNewFast(UpdateHistoryNewFast),
4648
SubscribeSymbol(SubscribeSymbol),
4749
UpdateAssets(UpdateAssets),
@@ -99,6 +101,11 @@ impl WebSocketMessage {
99101
return Self::UpdateStream(stream);
100102
}
101103
}
104+
MessageInfo::UpdateHistoryNew => {
105+
if let Ok(history) = from_str::<UpdateHistoryNewFast>(&data) {
106+
return Self::UpdateHistoryNew(history);
107+
}
108+
}
102109
MessageInfo::UpdateHistoryNewFast => {
103110
if let Ok(history) = from_str::<UpdateHistoryNewFast>(&data) {
104111
return Self::UpdateHistoryNewFast(history);
@@ -217,6 +224,7 @@ impl WebSocketMessage {
217224
pub fn information(&self) -> MessageInfo {
218225
match self {
219226
Self::UpdateStream(_) => MessageInfo::UpdateStream,
227+
Self::UpdateHistoryNew(_) => MessageInfo::UpdateHistoryNew,
220228
Self::UpdateHistoryNewFast(_) => MessageInfo::UpdateHistoryNewFast,
221229
Self::UpdateAssets(_) => MessageInfo::UpdateAssets,
222230
Self::UpdateBalance(_) => MessageInfo::UpdateBalance,
@@ -288,7 +296,7 @@ impl fmt::Display for WebSocketMessage {
288296
WebSocketMessage::Raw(text) => text.fmt(f),
289297

290298
WebSocketMessage::UpdateStream(update_stream) => write!(f, "{:?}", update_stream),
291-
WebSocketMessage::UpdateHistoryNewFast(update_history_new) => {
299+
WebSocketMessage::UpdateHistoryNewFast(update_history_new) | WebSocketMessage::UpdateHistoryNew(update_history_new)=> {
292300
write!(f, "{:?}", update_history_new)
293301
}
294302
WebSocketMessage::UpdateAssets(update_assets) => write!(f, "{:?}", update_assets),

crates/binary_options_tools/src/pocketoption/pocket_client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ impl PocketOption {
618618
chunck_size: impl Into<usize>,
619619
) -> PocketResult<StreamAsset> {
620620
info!(target: "SubscribeSymbolChuncked", "Subscribing to asset '{}'", asset.to_string());
621-
// Send 3 messages, 1 changesymbol, 2 unsubfor, 3 subfor
621+
// Send 3 messages, 1 changesymbol, 2 unsubfor, 3 subfor, honestly no clue why pocket option does that
622622
self.client.send(WebSocketMessage::ChangeSymbol(ChangeSymbol::new(asset.to_string(), 1))).await?;
623623
self.client.send(WebSocketMessage::Unsubfor(asset.to_string())).await?;
624624
self.client.send(WebSocketMessage::Subfor(asset.to_string())).await?;

crates/binary_options_tools/src/pocketoption/types/info.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use super::base::RawWebsocketMessage;
99
pub enum MessageInfo {
1010
OpenOrder,
1111
UpdateStream,
12+
UpdateHistoryNew,
1213
UpdateHistoryNewFast,
1314
UpdateAssets,
1415
UpdateBalance,

crates/core/src/general/client.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,15 @@ where
426426
})
427427
.await?)
428428
}
429+
430+
pub async fn send(&self, msg: Transfer) -> BinaryOptionsResult<()> {
431+
self.sender.send::<Transfer>(msg).await
432+
}
433+
434+
pub async fn raw_send(&self, msg: Transfer::Raw) -> BinaryOptionsResult<()> {
435+
self.sender.raw_send::<Transfer>(msg).await
436+
}
437+
429438
pub async fn send_message(
430439
&self,
431440
msg: Transfer,
@@ -437,10 +446,6 @@ where
437446
.await
438447
}
439448

440-
pub async fn raw_send(&self, msg: Transfer::Raw) -> BinaryOptionsResult<()> {
441-
self.sender.raw_send::<Transfer>(msg).await
442-
}
443-
444449
pub async fn send_raw_message(
445450
&self,
446451
msg: Transfer::Raw,

0 commit comments

Comments
 (0)