Comments (6)
will investigate
as a workaround:
var subscriptions: [AnyCancellable] = []
client.eventFeed.sink (
receiveCompletion: { completion in
print(completion)
}, receiveValue: { anyEvent in
switch anyEvent{
case let event as IBPriceHistory:
event.prices.forEach{print($0)}
print(String(repeating: "-", count: 30))
case let event as IBPriceBarUpdate:
print("update", event)
default: break
}
}
).store(in: &subscriptions)
do {
let requestID = client.nextRequestID
let crypto = IBContract.crypto("ETH", currency: "USD", exchange: .PAXOS)
// 5 minute history + updates
let lookback = IBDuration.continuousUpdates(300, unit: .second)
let resolution = IBBarSize.minute
let source = IBBarSource.trades
try client.requestPriceHistory(requestID, contract: crypto, barSize: resolution, barSource: source, lookback: lookback)
} catch {
print(error.localizedDescription)
}
output:
IBPriceBar(date: 2024-04-25 04:30:00 +0000, open: 3147.45, high: 3148.1, low: 3147.45, close: 3148.05, volume: Optional(0.00270185), wap: Optional(3147.93), count: Optional(4))
IBPriceBar(date: 2024-04-25 04:31:00 +0000, open: 3148.85, high: 3148.85, low: 3148.75, close: 3148.75, volume: Optional(0.02926551), wap: Optional(3148.755), count: Optional(4))
IBPriceBar(date: 2024-04-25 04:32:00 +0000, open: 3148.75, high: 3148.75, low: 3148.75, close: 3148.75, volume: Optional(0.0182358), wap: Optional(3148.75), count: Optional(1))
IBPriceBar(date: 2024-04-25 04:33:00 +0000, open: 3148.75, high: 3149.45, low: 3148.75, close: 3149.45, volume: Optional(0.06193536), wap: Optional(3148.93), count: Optional(2))
IBPriceBar(date: 2024-04-25 04:34:00 +0000, open: 3149.8, high: 3149.8, low: 3147.35, close: 3147.35, volume: Optional(0.04785002), wap: Optional(3147.385), count: Optional(3))
IBPriceBar(date: 2024-04-25 04:35:00 +0000, open: 3147.35, high: 3147.35, low: 3147.35, close: 3147.35, volume: nil, wap: Optional(3147.35), count: nil)
------------------------------
update IBPriceBarUpdate(requestID: 0, bar: IBKit.IBPriceBar(date: 2024-04-25 04:35:00 +0000, open: 3147.35, high: 3147.35, low: 3147.35, close: 3147.35, volume: Optional(3147.35), wap: nil, count: nil))
update IBPriceBarUpdate(requestID: 0, bar: IBKit.IBPriceBar(date: 2024-04-25 04:35:00 +0000, open: 3147.35, high: 3147.35, low: 3147.35, close: 3147.35, volume: Optional(3147.35), wap: nil, count: nil))
´´´
from ibkit.
I did run exactly the code you've suggested. with the result as shown below:
IBPriceBar(date: 2024-04-24 23:15:00 +0000, open: 3146.8, high: 3147.55, low: 3145.65, close: 3146.8, volume: Optional(1.01447713), wap: Optional(3146.755), count: Optional(10))
IBPriceBar(date: 2024-04-24 23:16:00 +0000, open: 3146.0, high: 3146.75, low: 3143.95, close: 3143.95, volume: Optional(0.01263599), wap: Optional(3145.365), count: Optional(11))
IBPriceBar(date: 2024-04-24 23:17:00 +0000, open: 3143.5, high: 3143.5, low: 3139.65, close: 3139.65, volume: Optional(0.36111044), wap: Optional(3142.775), count: Optional(8))
IBPriceBar(date: 2024-04-24 23:18:00 +0000, open: 3140.0, high: 3140.0, low: 3138.4, close: 3138.4, volume: Optional(0.17206784), wap: Optional(3139.925), count: Optional(12))
IBPriceBar(date: 2024-04-24 23:19:00 +0000, open: 3138.2, high: 3138.3, low: 3136.5, close: 3137.3, volume: Optional(0.28090953), wap: Optional(3137.19), count: Optional(21))
IBPriceBar(date: 2024-04-24 23:20:00 +0000, open: 3137.3, high: 3141.6, low: 3137.25, close: 3141.6, volume: Optional(0.4254993), wap: Optional(3139.54), count: Optional(18))
------------------------------
Decoding error: cant unwrap double from , cursor: 5 ["90", "1", "-1", "20240425-09:21:00", "", "", "", "", "0", "-1"]
Decoding error: cant unwrap double from , cursor: 5 ["90", "1", "-1", "20240425-09:21:00", "", "", "", "", "0", "-1"]
Decoding error: cant unwrap double from , cursor: 5 ["90", "1", "-1", "20240425-09:21:00", "", "", "", "", "0", "-1"]
from ibkit.
With the most recent update I included this request into playgrounds market data page. Does it produce the same error?
from ibkit.
yup, I use IB Gateway 10.19 from here
localised for AU
from ibkit.
I managed to reproduce the error earlier, but after using IBPriceBarHistoryUpdate instead of IBPriceBarUpdate for decoding, it seemed to vanish...
gateway 10.25
set region to Asia, time zone to Australia/Sydney
branch: main
playground page: market data
and the result:
Server version: Optional(175)
IBPriceBar(date: 2024-04-25 11:23:00 +0000, open: 3097.55, high: 3099.45, low: 3097.05, close: 3099.45, volume: Optional(0.49353841), wap: Optional(3098.74), count: Optional(29))
IBPriceBar(date: 2024-04-25 11:24:00 +0000, open: 3099.5, high: 3100.8, low: 3099.5, close: 3100.8, volume: Optional(0.33013874), wap: Optional(3099.94), count: Optional(33))
IBPriceBar(date: 2024-04-25 11:25:00 +0000, open: 3100.8, high: 3101.55, low: 3098.6, close: 3099.4, volume: Optional(0.57270639), wap: Optional(3098.98), count: Optional(26))
IBPriceBar(date: 2024-04-25 11:26:00 +0000, open: 3099.45, high: 3102.05, low: 3099.4, close: 3102.05, volume: Optional(0.03535837), wap: Optional(3101.225), count: Optional(20))
------------------------------
2024-04-25 11:26:52 +0000 update IBPriceBarUpdate(requestID: 0, bar: IBKit.IBPriceBar(date: 2024-04-25 11:26:00 +0000, open: 3099.45, high: 3101.0, low: 3102.05, close: 3099.4, volume: Optional(0.14970534), wap: Optional(3101.053141947041), count: nil))
2024-04-25 11:26:52 +0000 update IBPriceBarUpdate(requestID: 0, bar: IBKit.IBPriceBar(date: 2024-04-25 11:26:00 +0000, open: 3099.45, high: 3101.0, low: 3102.05, close: 3099.4, volume: Optional(0.14970534), wap: Optional(3101.053141947041), count: nil))
from ibkit.
This issue still persist for the given use case. when using IBDuration.continuousUpdates
from ibkit.
Related Issues (3)
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 ibkit.