-
Notifications
You must be signed in to change notification settings - Fork 59
/
wrapper.go
685 lines (592 loc) · 25.3 KB
/
wrapper.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
package ibapi
import (
"sync/atomic"
"time"
"go.uber.org/zap"
)
// IbWrapper contain the funcs to handle the msg from TWS or Gateway
type IbWrapper interface {
TickPrice(reqID int64, tickType int64, price float64, attrib TickAttrib)
TickSize(reqID int64, tickType int64, size int64)
OrderStatus(orderID int64, status string, filled float64, remaining float64, avgFillPrice float64, permID int64, parentID int64, lastFillPrice float64, clientID int64, whyHeld string, mktCapPrice float64)
Error(reqID int64, errCode int64, errString string)
OpenOrder(orderID int64, contract *Contract, order *Order, orderState *OrderState)
UpdateAccountValue(tag string, val string, currency string, accName string)
UpdatePortfolio(contract *Contract, position float64, marketPrice float64, marketValue float64, averageCost float64, unrealizedPNL float64, realizedPNL float64, accName string)
UpdateAccountTime(accTime time.Time)
NextValidID(reqID int64)
ContractDetails(reqID int64, conDetails *ContractDetails)
ExecDetails(reqID int64, contract *Contract, execution *Execution)
UpdateMktDepth(reqID int64, position int64, operation int64, side int64, price float64, size int64)
UpdateMktDepthL2(reqID int64, position int64, marketMaker string, operation int64, side int64, price float64, size int64, isSmartDepth bool)
UpdateNewsBulletin(msgID int64, msgType int64, newsMessage string, originExchange string)
ManagedAccounts(accountsList []string)
ReceiveFA(faData int64, cxml string)
HistoricalData(reqID int64, bar *BarData)
HistoricalDataEnd(reqID int64, startDateStr string, endDateStr string)
HistoricalDataUpdate(reqID int64, bar *BarData)
BondContractDetails(reqID int64, conDetails *ContractDetails)
ScannerParameters(xml string)
ScannerData(reqID int64, rank int64, conDetails *ContractDetails, distance string, benchmark string, projection string, legs string)
ScannerDataEnd(reqID int64)
TickOptionComputation(reqID int64, tickType int64, tickAttrib int64, impliedVol float64, delta float64, optPrice float64, pvDiviedn float64, gamma float64, vega float64, theta float64, undPrice float64)
TickGeneric(reqID int64, tickType int64, value float64)
TickString(reqID int64, tickType int64, value string)
TickEFP(reqID int64, tickType int64, basisPoints float64, formattedBasisPoints string, totalDividends float64, holdDays int64, futureLastTradeDate string, dividendImpact float64, dividendsToLastTradeDate float64)
CurrentTime(t time.Time)
RealtimeBar(reqID int64, time int64, open float64, high float64, low float64, close float64, volume int64, wap float64, count int64)
FundamentalData(reqID int64, data string)
ContractDetailsEnd(reqID int64)
OpenOrderEnd()
AccountDownloadEnd(accName string)
ExecDetailsEnd(reqID int64)
DeltaNeutralValidation(reqID int64, deltaNeutralContract DeltaNeutralContract)
TickSnapshotEnd(reqID int64)
MarketDataType(reqID int64, marketDataType int64)
Position(account string, contract *Contract, position float64, avgCost float64)
PositionEnd()
AccountSummary(reqID int64, account string, tag string, value string, currency string)
AccountSummaryEnd(reqID int64)
VerifyMessageAPI(apiData string)
VerifyCompleted(isSuccessful bool, err string)
DisplayGroupList(reqID int64, groups string)
DisplayGroupUpdated(reqID int64, contractInfo string)
VerifyAndAuthMessageAPI(apiData string, xyzChallange string)
VerifyAndAuthCompleted(isSuccessful bool, err string)
PositionMulti(reqID int64, account string, modelCode string, contract *Contract, position float64, avgCost float64)
PositionMultiEnd(reqID int64)
AccountUpdateMulti(reqID int64, account string, modleCode string, tag string, value string, currency string)
AccountUpdateMultiEnd(reqID int64)
SecurityDefinitionOptionParameter(reqID int64, exchange string, underlyingContractID int64, tradingClass string, multiplier string, expirations []string, strikes []float64)
SecurityDefinitionOptionParameterEnd(reqID int64)
SoftDollarTiers(reqID int64, tiers []SoftDollarTier)
FamilyCodes(famCodes []FamilyCode)
SymbolSamples(reqID int64, contractDescriptions []ContractDescription)
SmartComponents(reqID int64, smartComps []SmartComponent)
TickReqParams(tickerID int64, minTick float64, bboExchange string, snapshotPermissions int64)
MktDepthExchanges(depthMktDataDescriptions []DepthMktDataDescription)
HeadTimestamp(reqID int64, headTimestamp string)
TickNews(tickerID int64, timeStamp int64, providerCode string, articleID string, headline string, extraData string)
NewsProviders(newsProviders []NewsProvider)
NewsArticle(reqID int64, articleType int64, articleText string)
HistoricalNews(reqID int64, time string, providerCode string, articleID string, headline string)
HistoricalNewsEnd(reqID int64, hasMore bool)
HistogramData(reqID int64, histogram []HistogramData)
RerouteMktDataReq(reqID int64, contractID int64, exchange string)
RerouteMktDepthReq(reqID int64, contractID int64, exchange string)
MarketRule(marketRuleID int64, priceIncrements []PriceIncrement)
Pnl(reqID int64, dailyPnL float64, unrealizedPnL float64, realizedPnL float64)
PnlSingle(reqID int64, position int64, dailyPnL float64, unrealizedPnL float64, realizedPnL float64, value float64)
HistoricalTicks(reqID int64, ticks []HistoricalTick, done bool)
HistoricalTicksBidAsk(reqID int64, ticks []HistoricalTickBidAsk, done bool)
HistoricalTicksLast(reqID int64, ticks []HistoricalTickLast, done bool)
TickByTickAllLast(reqID int64, tickType int64, time int64, price float64, size int64, tickAttribLast TickAttribLast, exchange string, specialConditions string)
TickByTickBidAsk(reqID int64, time int64, bidPrice float64, askPrice float64, bidSize int64, askSize int64, tickAttribBidAsk TickAttribBidAsk)
TickByTickMidPoint(reqID int64, time int64, midPoint float64)
OrderBound(reqID int64, apiClientID int64, apiOrderID int64)
CompletedOrder(contract *Contract, order *Order, orderState *OrderState)
CompletedOrdersEnd()
CommissionReport(commissionReport CommissionReport)
ConnectAck()
ConnectionClosed()
ReplaceFAEnd(reqID int64, text string)
WshMetaData(reqID int64, dataJson string)
WshEventData(reqID int64, dataJson string)
}
// Wrapper is the default wrapper provided by this golang implement.
type Wrapper struct {
orderID int64
}
func (w *Wrapper) GetNextOrderID() (i int64) {
i = w.orderID
atomic.AddInt64(&w.orderID, 1)
return
}
func (w Wrapper) ConnectAck() {
log.Info("<ConnectAck>...")
}
func (w Wrapper) ConnectionClosed() {
log.Info("<ConnectionClosed>...")
}
func (w *Wrapper) NextValidID(reqID int64) {
atomic.StoreInt64(&w.orderID, reqID)
log.With(zap.Int64("reqID", reqID)).Info("<NextValidID>")
}
func (w Wrapper) ManagedAccounts(accountsList []string) {
log.Info("<ManagedAccounts>", zap.Strings("accountList", accountsList))
}
func (w Wrapper) TickPrice(reqID int64, tickType int64, price float64, attrib TickAttrib) {
log.With(zap.Int64("reqID", reqID)).Info("<TickPrice>", zap.Int64("tickType", tickType), zap.Float64("price", price))
}
func (w Wrapper) UpdateAccountTime(accTime time.Time) {
log.Info("<UpdateAccountTime>", zap.Time("accountTime", accTime))
}
func (w Wrapper) UpdateAccountValue(tag string, value string, currency string, account string) {
log.Info("<UpdateAccountValue>", zap.String("tag", tag), zap.String("value", value), zap.String("currency", currency), zap.String("account", account))
}
func (w Wrapper) AccountDownloadEnd(accName string) {
log.Info("<AccountDownloadEnd>", zap.String("accountName", accName))
}
func (w Wrapper) AccountUpdateMulti(reqID int64, account string, modelCode string, tag string, value string, currency string) {
log.With(zap.Int64("reqID", reqID)).Info("<AccountUpdateMulti>",
zap.String("account", account),
zap.String("modelCode", modelCode),
zap.String("tag", tag),
zap.String("value", value),
zap.String("curreny", currency),
)
}
func (w Wrapper) AccountUpdateMultiEnd(reqID int64) {
log.With(zap.Int64("reqID", reqID)).Info("<AccountUpdateMultiEnd>")
}
func (w Wrapper) AccountSummary(reqID int64, account string, tag string, value string, currency string) {
log.With(zap.Int64("reqID", reqID)).Info("<AccountSummary>",
zap.String("account", account),
zap.String("tag", tag),
zap.String("value", value),
zap.String("curreny", currency),
)
}
func (w Wrapper) AccountSummaryEnd(reqID int64) {
log.With(zap.Int64("reqID", reqID)).Info("<AccountSummaryEnd>")
}
func (w Wrapper) VerifyMessageAPI(apiData string) {
log.Info("<VerifyMessageAPI>", zap.String("apiData", apiData))
}
func (w Wrapper) VerifyCompleted(isSuccessful bool, err string) {
log.Info("<VerifyCompleted>", zap.Bool("isSuccessful", isSuccessful), zap.String("error", err))
}
func (w Wrapper) VerifyAndAuthMessageAPI(apiData string, xyzChallange string) {
log.Info("<VerifyMessageAPI>", zap.String("apiData", apiData), zap.String("xyzChallange", xyzChallange))
}
func (w Wrapper) VerifyAndAuthCompleted(isSuccessful bool, err string) {
log.Info("<VerifyCompleted>", zap.Bool("isSuccessful", isSuccessful), zap.String("error", err))
}
func (w Wrapper) DisplayGroupList(reqID int64, groups string) {
log.With(zap.Int64("reqID", reqID)).Info("<DisplayGroupList>", zap.String("groups", groups))
}
func (w Wrapper) DisplayGroupUpdated(reqID int64, contractInfo string) {
log.With(zap.Int64("reqID", reqID)).Info("<DisplayGroupUpdated>", zap.String("contractInfo", contractInfo))
}
func (w Wrapper) PositionMulti(reqID int64, account string, modelCode string, contract *Contract, position float64, avgCost float64) {
log.With(zap.Int64("reqID", reqID)).Info("<PositionMulti>",
zap.String("account", account),
zap.String("modelCode", modelCode),
zap.Any("contract", contract),
zap.Float64("position", position),
zap.Float64("avgCost", avgCost),
)
}
func (w Wrapper) PositionMultiEnd(reqID int64) {
log.With(zap.Int64("reqID", reqID)).Info("<PositionMultiEnd>")
}
func (w Wrapper) UpdatePortfolio(contract *Contract, position float64, marketPrice float64, marketValue float64, averageCost float64, unrealizedPNL float64, realizedPNL float64, accName string) {
log.Info("<UpdatePortfolio>",
zap.String("localSymbol", contract.LocalSymbol),
zap.Float64("position", position),
zap.Float64("marketPrice", marketPrice),
zap.Float64("averageCost", averageCost),
zap.Float64("unrealizedPNL", unrealizedPNL),
zap.Float64("realizedPNL", realizedPNL),
zap.String("accName", accName),
)
}
func (w Wrapper) Position(account string, contract *Contract, position float64, avgCost float64) {
log.Info("<UpdatePortfolio>",
zap.String("account", account),
zap.Any("contract", contract),
zap.Float64("position", position),
zap.Float64("avgCost", avgCost),
)
}
func (w Wrapper) PositionEnd() {
log.Info("<PositionEnd>")
}
func (w Wrapper) Pnl(reqID int64, dailyPnL float64, unrealizedPnL float64, realizedPnL float64) {
log.With(zap.Int64("reqID", reqID)).Info("<PNL>",
zap.Float64("dailyPnL", dailyPnL),
zap.Float64("unrealizedPnL", unrealizedPnL),
zap.Float64("realizedPnL", realizedPnL),
)
}
func (w Wrapper) PnlSingle(reqID int64, position int64, dailyPnL float64, unrealizedPnL float64, realizedPnL float64, value float64) {
log.With(zap.Int64("reqID", reqID)).Info("<PNLSingle>",
zap.Float64("dailyPnL", dailyPnL),
zap.Float64("unrealizedPnL", unrealizedPnL),
zap.Float64("realizedPnL", realizedPnL),
zap.Float64("value", value),
)
}
func (w Wrapper) OpenOrder(orderID int64, contract *Contract, order *Order, orderState *OrderState) {
log.With(zap.Int64("orderID", orderID)).Info("<OpenOrder>",
zap.Any("contract", contract),
zap.Any("order", order),
zap.Any("orderState", orderState),
)
}
func (w Wrapper) OpenOrderEnd() {
log.Info("<OpenOrderEnd>")
}
func (w Wrapper) OrderStatus(orderID int64, status string, filled float64, remaining float64, avgFillPrice float64, permID int64, parentID int64, lastFillPrice float64, clientID int64, whyHeld string, mktCapPrice float64) {
log.With(zap.Int64("orderID", orderID)).Info("<OrderStatus>",
zap.String("status", status),
zap.Float64("filled", filled),
zap.Float64("remaining", remaining),
zap.Float64("avgFillPrice", avgFillPrice),
)
}
func (w Wrapper) ExecDetails(reqID int64, contract *Contract, execution *Execution) {
log.With(zap.Int64("reqID", reqID)).Info("<ExecDetails>",
zap.Any("contract", contract),
zap.Any("execution", execution),
)
}
func (w Wrapper) ExecDetailsEnd(reqID int64) {
log.With(zap.Int64("reqID", reqID)).Info("<ExecDetailsEnd>")
}
func (w Wrapper) DeltaNeutralValidation(reqID int64, deltaNeutralContract DeltaNeutralContract) {
log.With(zap.Int64("reqID", reqID)).Info("<DeltaNeutralValidation>",
zap.Any("deltaNeutralContract", deltaNeutralContract),
)
}
func (w Wrapper) CommissionReport(commissionReport CommissionReport) {
log.Info("<CommissionReport>",
zap.Any("commissionReport", commissionReport),
)
}
func (w Wrapper) OrderBound(reqID int64, apiClientID int64, apiOrderID int64) {
log.With(zap.Int64("reqID", reqID)).Info("<OrderBound>",
zap.Int64("apiClientID", apiClientID),
zap.Int64("apiOrderID", apiOrderID),
)
}
func (w Wrapper) ContractDetails(reqID int64, conDetails *ContractDetails) {
log.With(zap.Int64("reqID", reqID)).Info("<ContractDetails>",
zap.Any("conDetails", conDetails),
)
}
func (w Wrapper) ContractDetailsEnd(reqID int64) {
log.With(zap.Int64("reqID", reqID)).Info("<ContractDetailsEnd>")
}
func (w Wrapper) BondContractDetails(reqID int64, conDetails *ContractDetails) {
log.With(zap.Int64("reqID", reqID)).Info("<BondContractDetails>",
zap.Any("conDetails", conDetails),
)
}
func (w Wrapper) SymbolSamples(reqID int64, contractDescriptions []ContractDescription) {
log.With(zap.Int64("reqID", reqID)).Info("<SymbolSamples>",
zap.Any("contractDescriptions", contractDescriptions),
)
}
func (w Wrapper) SmartComponents(reqID int64, smartComps []SmartComponent) {
log.With(zap.Int64("reqID", reqID)).Info("<SmartComponents>",
zap.Any("smartComps", smartComps),
)
}
func (w Wrapper) MarketRule(marketRuleID int64, priceIncrements []PriceIncrement) {
log.Info("<MarketRule>",
zap.Int64("marketRuleID", marketRuleID),
zap.Any("priceIncrements", priceIncrements),
)
}
func (w Wrapper) RealtimeBar(reqID int64, time int64, open float64, high float64, low float64, close float64, volume int64, wap float64, count int64) {
log.With(zap.Int64("reqID", reqID)).Info("<RealtimeBar>",
zap.Int64("time", time),
zap.Float64("open", open),
zap.Float64("high", high),
zap.Float64("low", low),
zap.Float64("close", close),
zap.Int64("volume", volume),
zap.Float64("wap", wap),
zap.Int64("count", count),
)
}
func (w Wrapper) HistoricalData(reqID int64, bar *BarData) {
log.With(zap.Int64("reqID", reqID)).Info("<HistoricalData>",
zap.Any("bar", bar),
)
}
func (w Wrapper) HistoricalDataEnd(reqID int64, startDateStr string, endDateStr string) {
log.With(zap.Int64("reqID", reqID)).Info("<HistoricalDataEnd>",
zap.String("startDate", startDateStr),
zap.String("endDate", endDateStr),
)
}
func (w Wrapper) HistoricalDataUpdate(reqID int64, bar *BarData) {
log.With(zap.Int64("reqID", reqID)).Info("<HistoricalDataUpdate>",
zap.Any("bar", bar),
)
}
func (w Wrapper) HeadTimestamp(reqID int64, headTimestamp string) {
log.With(zap.Int64("reqID", reqID)).Info("<HeadTimestamp>",
zap.String("headTimestamp", headTimestamp),
)
}
func (w Wrapper) HistoricalTicks(reqID int64, ticks []HistoricalTick, done bool) {
log.With(zap.Int64("reqID", reqID)).Info("<HistoricalTicks>",
zap.Any("ticks", ticks),
zap.Bool("done", done),
)
}
func (w Wrapper) HistoricalTicksBidAsk(reqID int64, ticks []HistoricalTickBidAsk, done bool) {
log.With(zap.Int64("reqID", reqID)).Info("<HistoricalTicksBidAsk>",
zap.Any("ticks", ticks),
zap.Bool("done", done),
)
}
func (w Wrapper) HistoricalTicksLast(reqID int64, ticks []HistoricalTickLast, done bool) {
log.With(zap.Int64("reqID", reqID)).Info("<HistoricalTicksLast>",
zap.Any("ticks", ticks),
zap.Bool("done", done),
)
}
func (w Wrapper) TickSize(reqID int64, tickType int64, size int64) {
log.With(zap.Int64("reqID", reqID)).Info("<TickSize>",
zap.Int64("tickType", tickType),
zap.Int64("size", size),
)
}
func (w Wrapper) TickSnapshotEnd(reqID int64) {
log.With(zap.Int64("reqID", reqID)).Info("<TickSnapshotEnd>")
}
func (w Wrapper) MarketDataType(reqID int64, marketDataType int64) {
log.With(zap.Int64("reqID", reqID)).Info("<MarketDataType>",
zap.Int64("marketDataType", marketDataType),
)
}
func (w Wrapper) TickByTickAllLast(reqID int64, tickType int64, time int64, price float64, size int64, tickAttribLast TickAttribLast, exchange string, specialConditions string) {
log.With(zap.Int64("reqID", reqID)).Info("<TickByTickAllLast>",
zap.Int64("tickType", tickType),
zap.Int64("time", time),
zap.Float64("price", price),
zap.Int64("size", size),
)
}
func (w Wrapper) TickByTickBidAsk(reqID int64, time int64, bidPrice float64, askPrice float64, bidSize int64, askSize int64, tickAttribBidAsk TickAttribBidAsk) {
log.With(zap.Int64("reqID", reqID)).Info("<TickByTickBidAsk>",
zap.Int64("time", time),
zap.Float64("bidPrice", bidPrice),
zap.Float64("askPrice", askPrice),
zap.Int64("bidPrice", bidSize),
zap.Int64("askPrice", askSize),
)
}
func (w Wrapper) TickByTickMidPoint(reqID int64, time int64, midPoint float64) {
log.With(zap.Int64("reqID", reqID)).Info("<TickByTickMidPoint>",
zap.Int64("time", time),
zap.Float64("midPoint", midPoint),
)
}
func (w Wrapper) TickString(reqID int64, tickType int64, value string) {
log.With(zap.Int64("reqID", reqID)).Info("<TickString>",
zap.Int64("tickType", tickType),
zap.String("value", value),
)
}
func (w Wrapper) TickGeneric(reqID int64, tickType int64, value float64) {
log.With(zap.Int64("reqID", reqID)).Info("<TickGeneric>",
zap.Int64("tickType", tickType),
zap.Float64("value", value),
)
}
func (w Wrapper) TickEFP(reqID int64, tickType int64, basisPoints float64, formattedBasisPoints string, totalDividends float64, holdDays int64, futureLastTradeDate string, dividendImpact float64, dividendsToLastTradeDate float64) {
log.With(zap.Int64("reqID", reqID)).Info("<TickEFP>",
zap.Int64("tickType", tickType),
zap.Float64("basisPoints", basisPoints),
)
}
func (w Wrapper) TickReqParams(reqID int64, minTick float64, bboExchange string, snapshotPermissions int64) {
log.With(zap.Int64("reqID", reqID)).Info("<TickReqParams>",
zap.Float64("minTick", minTick),
zap.String("bboExchange", bboExchange),
zap.Int64("snapshotPermissions", snapshotPermissions),
)
}
func (w Wrapper) MktDepthExchanges(depthMktDataDescriptions []DepthMktDataDescription) {
log.Info("<MktDepthExchanges>",
zap.Any("depthMktDataDescriptions", depthMktDataDescriptions),
)
}
/*Returns the order book.
tickerId - the request's identifier
position - the order book's row being updated
operation - how to refresh the row:
0 = insert (insert this new order into the row identified by 'position')
1 = update (update the existing order in the row identified by 'position')
2 = delete (delete the existing order at the row identified by 'position').
side - 0 for ask, 1 for bid
price - the order's price
size - the order's size*/
func (w Wrapper) UpdateMktDepth(reqID int64, position int64, operation int64, side int64, price float64, size int64) {
log.With(zap.Int64("reqID", reqID)).Info("<UpdateMktDepth>",
zap.Int64("position", position),
zap.Int64("operation", operation),
zap.Int64("side", side),
zap.Float64("price", price),
zap.Int64("size", size),
)
}
func (w Wrapper) UpdateMktDepthL2(reqID int64, position int64, marketMaker string, operation int64, side int64, price float64, size int64, isSmartDepth bool) {
log.With(zap.Int64("reqID", reqID)).Info("<UpdateMktDepthL2>",
zap.Int64("position", position),
zap.String("marketMaker", marketMaker),
zap.Int64("operation", operation),
zap.Int64("side", side),
zap.Float64("price", price),
zap.Int64("size", size),
zap.Bool("isSmartDepth", isSmartDepth),
)
}
func (w Wrapper) TickOptionComputation(reqID int64, tickType int64, tickAttrib int64, impliedVol float64, delta float64, optPrice float64, pvDiviedn float64, gamma float64, vega float64, theta float64, undPrice float64) {
log.With(zap.Int64("reqID", reqID)).Info("<TickOptionComputation>",
zap.Int64("tickType", tickType),
zap.Int64("tickAttrib", tickAttrib),
zap.Float64("impliedVol", impliedVol),
zap.Float64("delta", delta),
zap.Float64("optPrice", optPrice),
zap.Float64("pvDiviedn", pvDiviedn),
zap.Float64("gamma", gamma),
zap.Float64("vega", vega),
zap.Float64("theta", theta),
zap.Float64("undPrice", undPrice),
)
}
func (w Wrapper) FundamentalData(reqID int64, data string) {
log.With(zap.Int64("reqID", reqID)).Info("<FundamentalData>",
zap.String("data", data),
)
}
func (w Wrapper) ScannerParameters(xml string) {
log.Info("<ScannerParameters>",
zap.String("xml", xml),
)
}
func (w Wrapper) ScannerData(reqID int64, rank int64, conDetails *ContractDetails, distance string, benchmark string, projection string, legs string) {
log.With(zap.Int64("reqID", reqID)).Info("<ScannerData>",
zap.Int64("rank", rank),
zap.Any("conDetails", conDetails),
zap.String("distance", distance),
zap.String("benchmark", benchmark),
zap.String("projection", projection),
zap.String("legs", legs),
)
}
func (w Wrapper) ScannerDataEnd(reqID int64) {
log.With(zap.Int64("reqID", reqID)).Info("<ScannerDataEnd>")
}
func (w Wrapper) HistogramData(reqID int64, histogram []HistogramData) {
log.With(zap.Int64("reqID", reqID)).Info("<HistogramData>",
zap.Any("histogram", histogram),
)
}
func (w Wrapper) RerouteMktDataReq(reqID int64, contractID int64, exchange string) {
log.With(zap.Int64("reqID", reqID)).Info("<RerouteMktDataReq>",
zap.Int64("contractID", contractID),
zap.String("exchange", exchange),
)
}
func (w Wrapper) RerouteMktDepthReq(reqID int64, contractID int64, exchange string) {
log.With(zap.Int64("reqID", reqID)).Info("<RerouteMktDepthReq>",
zap.Int64("contractID", contractID),
zap.String("exchange", exchange),
)
}
func (w Wrapper) SecurityDefinitionOptionParameter(reqID int64, exchange string, underlyingContractID int64, tradingClass string, multiplier string, expirations []string, strikes []float64) {
log.With(zap.Int64("reqID", reqID)).Info("<SecurityDefinitionOptionParameter>",
zap.String("exchange", exchange),
zap.Int64("underlyingContractID", underlyingContractID),
zap.String("tradingClass", tradingClass),
zap.String("multiplier", multiplier),
zap.Strings("expirations", expirations),
zap.Float64s("strikes", strikes),
)
}
func (w Wrapper) SecurityDefinitionOptionParameterEnd(reqID int64) {
log.With(zap.Int64("reqID", reqID)).Info("<SecurityDefinitionOptionParameterEnd>")
}
func (w Wrapper) SoftDollarTiers(reqID int64, tiers []SoftDollarTier) {
log.With(zap.Int64("reqID", reqID)).Info("<SoftDollarTiers>",
zap.Any("tiers", tiers),
)
}
func (w Wrapper) FamilyCodes(famCodes []FamilyCode) {
log.Info("<FamilyCodes>",
zap.Any("famCodes", famCodes),
)
}
func (w Wrapper) NewsProviders(newsProviders []NewsProvider) {
log.Info("<NewsProviders>",
zap.Any("newsProviders", newsProviders),
)
}
func (w Wrapper) TickNews(tickerID int64, timeStamp int64, providerCode string, articleID string, headline string, extraData string) {
log.With(zap.Int64("tickerID", tickerID)).Info("<TickNews>",
zap.Int64("timeStamp", timeStamp),
zap.String("providerCode", providerCode),
zap.String("articleID", articleID),
zap.String("headline", headline),
zap.String("extraData", extraData),
)
}
func (w Wrapper) NewsArticle(reqID int64, articleType int64, articleText string) {
log.With(zap.Int64("reqID", reqID)).Info("<NewsArticle>",
zap.Int64("articleType", articleType),
zap.String("articleText", articleText),
)
}
func (w Wrapper) HistoricalNews(reqID int64, time string, providerCode string, articleID string, headline string) {
log.With(zap.Int64("reqID", reqID)).Info("<HistoricalNews>",
zap.String("time", time),
zap.String("providerCode", providerCode),
zap.String("articleID", articleID),
zap.String("headline", headline),
)
}
func (w Wrapper) HistoricalNewsEnd(reqID int64, hasMore bool) {
log.With(zap.Int64("reqID", reqID)).Info("<HistoricalNewsEnd>",
zap.Bool("hasMore", hasMore),
)
}
func (w Wrapper) UpdateNewsBulletin(msgID int64, msgType int64, newsMessage string, originExch string) {
log.With(zap.Int64("msgID", msgID)).Info("<UpdateNewsBulletin>",
zap.Int64("msgType", msgType),
zap.String("newsMessage", newsMessage),
zap.String("originExch", originExch),
)
}
func (w Wrapper) ReceiveFA(faData int64, cxml string) {
log.Info("<ReceiveFA>",
zap.Int64("faData", faData),
zap.String("cxml", cxml),
)
}
func (w Wrapper) CurrentTime(t time.Time) {
log.Info("<CurrentTime>",
zap.Time("time", t),
)
}
func (w Wrapper) Error(reqID int64, errCode int64, errString string) {
log.With(zap.Int64("reqID", reqID)).Info("<Error>",
zap.Int64("errCode", errCode),
zap.String("errString", errString),
)
}
func (w Wrapper) CompletedOrder(contract *Contract, order *Order, orderState *OrderState) {
log.Info("<CompletedOrder>",
zap.Any("contract", contract),
zap.Any("order", order),
zap.Any("orderState", orderState),
)
}
func (w Wrapper) CompletedOrdersEnd() {
log.Info("<CompletedOrdersEnd>:")
}
func (w Wrapper) ReplaceFAEnd(reqID int64, text string) {
log.With(zap.Int64("reqID", reqID)).Info("<ReplaceFAEnd>", zap.String("text", text))
}
func (w Wrapper) WshMetaData(reqID int64, dataJson string) {
log.With(zap.Int64("reqID", reqID)).Info("<WshMetaData>", zap.String("dataJson", dataJson))
}
func (w Wrapper) WshEventData(reqID int64, dataJson string) {
log.With(zap.Int64("reqID", reqID)).Info("<WshEventData>", zap.String("dataJson", dataJson))
}