-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathstocks.go
1753 lines (1604 loc) · 51 KB
/
stocks.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
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package goiex
import (
"encoding/json"
"fmt"
"net/http"
"net/url"
"strconv"
)
// IndicatorName for TechnicalIndicator API
type IndicatorName int
const (
// ABS Vector Absolute Value
ABS IndicatorName = iota
// ACOS Vector Arccosine
ACOS
// AD Accumulation/Distribution Line
AD
// ADD Vector Addition
ADD
// ADOSC Accumulation/Distribution Oscillator
ADOSC
// ADX Average Directional Movement Index
ADX
// ADXR Average Directional Movement Rating
ADXR
// AO Awesome Oscillator
AO
// APO Absolute Price Oscillator
APO
// AROON Aroon
AROON
// AROONOSC Aroon Oscillator
AROONOSC
// ASIN Vector Arcsine
ASIN
// ATAN Vector Arctangent
ATAN
// ATR Average True Range
ATR
// AVGPRICE Average Price
AVGPRICE
// BBANDS Bollinger Bands
BBANDS
// BOP Balance of Power
BOP
// CCI Commodity Channel Index
CCI
// CEIL Vector Ceiling
CEIL
// CMO Change Momentum Oscillator
CMO
// COS Vector Cosine
COS
// COSH Vector Hyperbolic Cosine
COSH
// CROSSANY Crossany
CROSSANY
// CROSSOVER Crossover
CROSSOVER
// CVI Chaikins Volatility
CVI
// DECAY Linear Decay
DECAY
// DEMA Double Exponential Moving Average
DEMA
// DI Directional Indicator
DI
// DIV Vector Division
DIV
// DM Directional Movement
DM
// DPO Detrended Price Oscillator
DPO
// DX Directional Movement Index
DX
// EDECAY Exponential Decay
EDECAY
// EMA Exponential Moving Average
EMA
// EMV Ease of Movement
EMV
// EXP Vector Exponential
EXP
// FISHER Fisher Transform
FISHER
// FLOOR Vector Floor
FLOOR
// FOSC Forecast Oscillator
FOSC
// HMA Hull Moving Average
HMA
// KAMA Kaufman Adaptive Moving Average
KAMA
// KVO Klinger Volume Oscillator
KVO
// LAG Lag
LAG
// LINREG Linear Regression
LINREG
// LINREGINTERCEPT Linear Regression Intercept
LINREGINTERCEPT
// LINREGSLOPE Linear Regression Slope
LINREGSLOPE
// LN Vector Natural Log
LN
// LOG10 Vector Base-10 Log
LOG10
// MACD Moving Average Convergence/Divergence
MACD
// MARKETFI Market Facilitation Index
MARKETFI
// MASS Mass Index
MASS
// MAX Maximum In Period
MAX
// MD Mean Deviation Over Period
MD
// MEDPRICE Median Price
MEDPRICE
// MFI Money Flow Index
MFI
// MIN Minimum In Period
MIN
// MOM Momentum
MOM
// MSW Mesa Sine Wave
MSW
// MUL Vector Multiplication
MUL
// NATR Normalized Average True Range
NATR
// NVI Negative Volume Index
NVI
// OBV On Balance Volume
OBV
// PPO Percentage Price Oscillator
PPO
// PSAR Parabolic SAR
PSAR
// PVI Positive Volume Index
PVI
// QSTICK Qstick
QSTICK
// ROC Rate of Change
ROC
// ROCR Rate of Change Ratio
ROCR
// ROUND Vector Round
ROUND
// RSI Relative Strength Index
RSI
// SIN Vector Sine
SIN
// SINH Vector Hyperbolic Sine
SINH
// SMA Simple Moving Average
SMA
// SQRT Vector Square Root
SQRT
// STDDEV Standard Deviation Over Period
STDDEV
// STOCH Stochastic Oscillator
STOCH
// STOCHRSI Stochastic RSI
STOCHRSI
// SUB Vector Subtraction
SUB
// SUM Sum Over Period
SUM
// TAN Vector Tangent
TAN
// TANH Vector Hyperbolic Tangent
TANH
// TEMA Triple Exponential Moving Average
TEMA
// TODEG Vector Degree Conversion
TODEG
// TORAD Vector Radian Conversion
TORAD
// TR True Range
TR
// TRIMA Triangular Moving Average
TRIMA
// TRIX Trix
TRIX
// TRUNC Vector Truncate
TRUNC
// TSF Time Series Forecast
TSF
// TYPPRICE Typical Price
TYPPRICE
// ULTOSC Ultimate Oscillator
ULTOSC
// VAR Variance Over Period
VAR
// VHF Vertical Horizontal Filter
VHF
// VIDYA Variable Index Dynamic Average
VIDYA
// VOLATILITY Annualized Historical Volatility
VOLATILITY
// VOSC Volume Oscillator
VOSC
// VWMA Volume Weighted Moving Average
VWMA
// WAD Williams Accumulation/Distribution
WAD
// WCPRICE Weight Close Price
WCPRICE
// WILDERS Wilders Smoothing
WILDERS
// WILLR Williams %R
WILLR
// WMA Weighted Moving Average
WMA
// ZLEMA Zero-Lag Exponential Moving Average
ZLEMA
)
// ChartRange for Chart API
type ChartRange int
const (
// ChartRangeMax chart range
ChartRangeMax ChartRange = iota
// ChartRangeFiveYear chart range
ChartRangeFiveYear
// ChartRangeTwoYear chart range
ChartRangeTwoYear
// ChartRangeOneYear chart range
ChartRangeOneYear
// ChartRangeYearToDate chart range
ChartRangeYearToDate
// ChartRangeSixMonth chart range
ChartRangeSixMonth
// ChartRangeThreeMonth chart range
ChartRangeThreeMonth
// ChartRangeOneMonth chart range
ChartRangeOneMonth
// ChartRangeOneDay chart range
ChartRangeOneDay
)
// ChartQueryParams optional query parameters
type ChartQueryParams struct {
ChartCloseOnly bool `url:"chartCloseOnly,omitempty"`
ChartByDay bool `url:"chartByDay,omitempty"`
ChartSimplify bool `url:"chartSimplify,omitempty"`
ChartInterval uint `url:"chartInterval,omitempty"`
ChangeFromClose bool `url:"changeFromClose,omitempty"`
ChartLast uint `url:"chartLast,omitempty"`
Range ChartRange `url:"range,omitempty"`
// ExactDate date formatted as YYYYMMDD
ExactDate string `url:"exactDate,omitempty"`
// Sort can be `asc` or `desc`. Defaults to `desc`.
Sort string `url:"sort,omitempty"`
// IncludeToday appends current trading to data
IncludeToday bool `url:"includeToday,omitempty"`
}
// DividendRange for Dividend API
type DividendRange int
const (
// DividendRangeFiveYear dividend range
DividendRangeFiveYear DividendRange = iota
// DividendRangeTwoYear dividend range
DividendRangeTwoYear
// DividendRangeOneYear dividend range
DividendRangeOneYear
// DividendRangeYearToDate dividend range
DividendRangeYearToDate
// DividendRangeSixMonth dividend range
DividendRangeSixMonth
// DividendRangeThreeMonth dividend range
DividendRangeThreeMonth
// DividendRangeOneMonth dividend range
DividendRangeOneMonth
// DividendRangeNext dividend range
DividendRangeNext
)
// SplitRange for Split API
type SplitRange int
const (
// SplitRangeFiveYear split range
SplitRangeFiveYear SplitRange = iota
// SplitRangeTwoYear split range
SplitRangeTwoYear
// SplitRangeOneYear split range
SplitRangeOneYear
// SplitRangeYearToDate split range
SplitRangeYearToDate
// SplitRangeSixMonth split range
SplitRangeSixMonth
// SplitRangeThreeMonth split range
SplitRangeThreeMonth
// SplitRangeOneMonth split range
SplitRangeOneMonth
// SplitRangeNext split range
SplitRangeNext
)
// PeriodQueryParameter accepted values for query parameter `period`
type PeriodQueryParameter int
const (
// PeriodAnnual annual period
PeriodAnnual PeriodQueryParameter = iota
// PeriodQuarter quarter period
PeriodQuarter
)
// TechnicalIndicatorRange for TechnicalIndicator API
type TechnicalIndicatorRange int
const (
// TechnicalIndicatorRangeMax chart range
TechnicalIndicatorRangeMax TechnicalIndicatorRange = iota
// TechnicalIndicatorRangeFiveYear chart range
TechnicalIndicatorRangeFiveYear
// TechnicalIndicatorRangeTwoYear chart range
TechnicalIndicatorRangeTwoYear
// TechnicalIndicatorRangeOneYear chart range
TechnicalIndicatorRangeOneYear
// TechnicalIndicatorRangeYearToDate chart range
TechnicalIndicatorRangeYearToDate
// TechnicalIndicatorRangeSixMonth chart range
TechnicalIndicatorRangeSixMonth
// TechnicalIndicatorRangeThreeMonth chart range
TechnicalIndicatorRangeThreeMonth
// TechnicalIndicatorRangeOneMonth chart range
TechnicalIndicatorRangeOneMonth
// TechnicalIndicatorRangeOneDay chart range
TechnicalIndicatorRangeOneDay
)
// Stock struct to interface with /stock endpoints
type Stock struct {
iex
}
// AdvancedStat struct
type AdvancedStat struct {
KeyStat
TotalCash int64 `json:"totalCash"`
CurrentDebt int64 `json:"currentDebt"`
Revenue int64 `json:"revenue"`
GrossProfit int64 `json:"grossProfit"`
TotalRevenue int64 `json:"totalRevenue"`
EBITDA int64 `json:"EBITDA"`
RevenuePerShare float64 `json:"revenuePerShare"`
RevenuePerEmployee float64 `json:"revenuePerEmployee"`
DebtToEquity float64 `json:"debtToEquity"`
ProfitMargin float64 `json:"profitMargin"`
EnterpriseValue int64 `json:"enterpriseValue"`
EnterpriseValueToRevenue float64 `json:"enterpriseValueToRevenue"`
PriceToSales float64 `json:"priceToSales"`
PriceToBook float64 `json:"priceToBook"`
ForwardPERatio interface{} `json:"forwardPERatio"`
PegRatio float64 `json:"pegRatio"`
}
// Asks struct
type Asks []struct {
Price float64 `json:"price"`
Size int `json:"size"`
Timestamp int64 `json:"timestamp"`
}
// BalanceSheetParams query parameters
type BalanceSheetParams struct {
// Period specify either "annual" or "quarter" with PeriodQueryParameter
Period PeriodQueryParameter `url:"period"`
// Last with "quarter" period can specify up to 12 and up to 4 with "annual" period
Last int `url:"last"`
}
// BalanceSheet struct
type BalanceSheet struct {
Symbol string `json:"symbol"`
BalanceSheet []struct {
ReportDate string `json:"reportDate"`
CurrentCash int64 `json:"currentCash"`
ShortTermInvestments int64 `json:"shortTermInvestments"`
Receivables int64 `json:"receivables"`
Inventory int64 `json:"inventory"`
OtherCurrentAssets int64 `json:"otherCurrentAssets"`
CurrentAssets int64 `json:"currentAssets"`
LongTermInvestments int64 `json:"longTermInvestments"`
PropertyPlantEquipment int64 `json:"propertyPlantEquipment"`
Goodwill interface{} `json:"goodwill"`
IntangibleAssets interface{} `json:"intangibleAssets"`
OtherAssets int64 `json:"otherAssets"`
TotalAssets int64 `json:"totalAssets"`
AccountsPayable int64 `json:"accountsPayable"`
CurrentLongTermDebt int64 `json:"currentLongTermDebt"`
OtherCurrentLiabilities int64 `json:"otherCurrentLiabilities"`
TotalCurrentLiabilities int64 `json:"totalCurrentLiabilities"`
LongTermDebt int64 `json:"longTermDebt"`
OtherLiabilities int64 `json:"otherLiabilities"`
MinorityInterest int `json:"minorityInterest"`
TotalLiabilities int64 `json:"totalLiabilities"`
CommonStock int64 `json:"commonStock"`
RetainedEarnings int64 `json:"retainedEarnings"`
TreasuryStock interface{} `json:"treasuryStock"`
CapitalSurplus interface{} `json:"capitalSurplus"`
ShareholderEquity int64 `json:"shareholderEquity"`
NetTangibleAssets int64 `json:"netTangibleAssets"`
} `json:"balancesheet"`
}
// Batch struct
type Batch struct {
Quote Quote
News News
Chart []Chart
}
// Bids struct
type Bids []struct {
Price float64 `json:"price"`
Size int `json:"size"`
Timestamp int64 `json:"timestamp"`
}
// Book struct
type Book struct {
Asks Asks
Bids Bids
Quote Quote
Trades Trades
SystemEvent SystemEvent
}
// CashFlowQueryParams optional query parameters
type CashFlowQueryParams struct {
Period PeriodQueryParameter `url:"period"`
Last uint `url:"last,omitempty"`
}
// CashFlow struct
type CashFlow struct {
Symbol string `json:"symbol"`
CashFlow []struct {
ReportDate string `json:"reportDate"`
NetIncome int64 `json:"netIncome"`
Depreciation int64 `json:"depreciation"`
ChangesInReceivables int64 `json:"changesInReceivables"`
ChangesInInventories int `json:"changesInInventories"`
CashChange int64 `json:"cashChange"`
CashFlow int64 `json:"cashFlow"`
CapitalExpenditures int64 `json:"capitalExpenditures"`
Investments int `json:"investments"`
InvestingActivityOther int `json:"investingActivityOther"`
TotalInvestingCashFlows int64 `json:"totalInvestingCashFlows"`
DividendsPaid int64 `json:"dividendsPaid"`
NetBorrowings int `json:"netBorrowings"`
OtherFinancingCashFlows int `json:"otherFinancingCashFlows"`
CashFlowFinancing int64 `json:"cashFlowFinancing"`
ExchangeRateEffect interface{} `json:"exchangeRateEffect"`
} `json:"cashflow"`
}
// Chart struct
type Chart struct {
Date string `json:"date"`
Open float64 `json:"open"`
High float64 `json:"high"`
Low float64 `json:"low"`
Close float64 `json:"close"`
Volume int `json:"volume"`
UOpen float64 `json:"uOpen"`
UHigh float64 `json:"uHigh"`
ULow float64 `json:"uLow"`
UClose float64 `json:"uClose"`
UVolume int `json:"uVolume"`
Change float64 `json:"change"`
ChangePercent float64 `json:"changePercent"`
Label string `json:"label"`
ChangeOverTime float64 `json:"changeOverTime"`
}
// CollectionType for Collection API
type CollectionType int
const (
// CollectionSector for sectors
CollectionSector CollectionType = iota
// CollectionTag for tags
CollectionTag
// CollectionList for lists
CollectionList
)
// CollectionQueryParams required/optional query parameters
type CollectionQueryParams struct {
CollectionName string `url:"collectionName"`
}
// Collection struct
type Collection []struct {
Quote
}
// Company struct
type Company struct {
Symbol string `json:"symbol"`
CompanyName string `json:"companyName"`
Employees int `json:"employees"`
Exchange string `json:"exchange"`
Industry string `json:"industry"`
Website string `json:"website"`
Description string `json:"description"`
CEO string `json:"CEO"`
IssueType string `json:"issueType"`
Sector string `json:"sector"`
Tags []string `json:"tags"`
}
// DelayedQuote struct
type DelayedQuote struct {
Symbol string `json:"symbol"`
DelayedPrice float64 `json:"delayedPrice"`
DelayedSize int `json:"delayedSize"`
DelayedPriceTime int64 `json:"delayedPriceTime"`
High float64 `json:"high"`
Low float64 `json:"low"`
TotalVolume int `json:"totalVolume"`
ProcessedTime int64 `json:"processedTime"`
}
// Dividends struct {
type Dividends []struct {
Symbol string `json:"symbol"`
ExDate string `json:"exDate"`
PaymentDate string `json:"paymentDate"`
RecordDate string `json:"recordDate"`
DeclaredDate string `json:"declaredDate"`
Amount float64 `json:"amount,string"`
Flag string `json:"flag"`
Currency string `json:"currency"`
Description string `json:"description"`
Frequency string `json:"frequency"`
}
// Earning DTO for APIs reporting earnings
type Earning struct {
ActualEPS float64 `json:"actualEPS"`
ConsensusEPS float64 `json:"consensusEPS"`
AnnounceTime string `json:"announceTime"`
NumberOfEstimates int `json:"numberOfEstimates"`
EPSSurpriseDollar float64 `json:"EPSSurpriseDollar"`
EPSReportDate string `json:"EPSReportDate"`
FiscalPeriod string `json:"fiscalPeriod"`
FiscalEndDate string `json:"fiscalEndDate"`
YearAgo float64 `json:"yearAgo"`
YearAgoChangePercent float64 `json:"yearAgoChangePercent"`
}
// EarningsQueryParams required/optional query parameters
type EarningsQueryParams struct {
Last uint `url:"last,omitempty"`
Period PeriodQueryParameter `url:"period"`
}
// Earnings struct
type Earnings struct {
Symbol string `json:"symbol"`
Earnings []Earning `json:"earnings"`
}
// EarningsToday struct
type EarningsToday struct {
BTO []EarningsTodayDTO `json:"bto"`
AMC []EarningsTodayDTO `json:"amc"`
DMT []EarningsTodayDTO `json:"dmt"`
Other []EarningsTodayDTO `json:"other"`
}
// EarningsTodayDTO struct
type EarningsTodayDTO struct {
ConsensusEPS float64 `json:"consensusEPS"`
AnnounceTime string `json:"announceTime"`
NumberOfEstimates int `json:"numberOfEstimates"`
FiscalPeriod string `json:"fiscalPeriod"`
FiscalEndDate string `json:"fiscalEndDate"`
Symbol string `json:"symbol"`
Quote Quote `json:"quote"`
}
// Estimates struct
type Estimates struct {
Symbol string `json:"symbol"`
Estimates []struct {
ConsensusEPS float64 `json:"consensusEPS"`
NumberOfEstimates int `json:"numberOfEstimates"`
FiscalPeriod string `json:"fiscalPeriod"`
FiscalEndDate string `json:"fiscalEndDate"`
ReportDate string `json:"reportDate"`
} `json:"estimates"`
}
// FinancialsQueryParams required/optional query params
type FinancialsQueryParams struct {
Period PeriodQueryParameter `url:"period"`
}
// Financials struct
type Financials struct {
Symbol string `json:"symbol"`
Financials []struct {
ReportDate string `json:"reportDate"`
GrossProfit int64 `json:"grossProfit"`
CostOfRevenue int64 `json:"costOfRevenue"`
OperatingRevenue int64 `json:"operatingRevenue"`
TotalRevenue int64 `json:"totalRevenue"`
OperatingIncome int64 `json:"operatingIncome"`
NetIncome int64 `json:"netIncome"`
ResearchAndDevelopment int64 `json:"researchAndDevelopment"`
OperatingExpense int64 `json:"operatingExpense"`
CurrentAssets int64 `json:"currentAssets"`
TotalAssets int64 `json:"totalAssets"`
TotalLiabilities int64 `json:"totalLiabilities"`
CurrentCash int64 `json:"currentCash"`
CurrentDebt int64 `json:"currentDebt"`
TotalCash int64 `json:"totalCash"`
TotalDebt int64 `json:"totalDebt"`
ShareholderEquity int64 `json:"shareholderEquity"`
CashChange int `json:"cashChange"`
CashFlow int64 `json:"cashFlow"`
OperatingGainsLosses interface{} `json:"operatingGainsLosses"`
} `json:"financials"`
}
// FundOwnership struct
type FundOwnership []struct {
AdjHolding int `json:"adjHolding"`
AdjMv int `json:"adjMv"`
EntityProperName string `json:"entityProperName"`
ReportDate int64 `json:"reportDate"`
ReportedHolding int `json:"reportedHolding"`
ReportedMv int `json:"reportedMv"`
}
// IncomeStatementQueryParams required/optional query parameters
type IncomeStatementQueryParams struct {
Period PeriodQueryParameter `url:"period"`
Last uint `url:"last,omitempty"`
}
// IncomeStatement struct
type IncomeStatement struct {
Symbol string `json:"symbol"`
Income []struct {
ReportDate string `json:"reportDate"`
TotalRevenue int64 `json:"totalRevenue"`
CostOfRevenue int64 `json:"costOfRevenue"`
GrossProfit int64 `json:"grossProfit"`
ResearchAndDevelopment int64 `json:"researchAndDevelopment"`
SellingGeneralAndAdmin int64 `json:"sellingGeneralAndAdmin"`
OperatingExpense int64 `json:"operatingExpense"`
OperatingIncome int64 `json:"operatingIncome"`
OtherIncomeExpenseNet int `json:"otherIncomeExpenseNet"`
Ebit int64 `json:"ebit"`
InterestIncome int `json:"interestIncome"`
PretaxIncome int64 `json:"pretaxIncome"`
IncomeTax int64 `json:"incomeTax"`
MinorityInterest int `json:"minorityInterest"`
NetIncome int64 `json:"netIncome"`
NetIncomeBasic int64 `json:"netIncomeBasic"`
} `json:"income"`
}
// InsiderRoster struct
type InsiderRoster []struct {
EntityName string `json:"entityName'"`
Position int `json:"position"`
ReportDate int64 `json:"reportDate"`
}
// InsiderSummary struct
type InsiderSummary []struct {
FullName string `json:"fullName"`
NetTransacted int `json:"netTransacted"`
ReportedTitle string `json:"reportedTitle"`
TotalBought int `json:"totalBought"`
TotalSold int `json:"totalSold"`
}
// InsiderTransactions struct
type InsiderTransactions []struct {
EffectiveDate int64 `json:"effectiveDate"`
FullName string `json:"fullName"`
ReportedTitle string `json:"reportedTitle"`
TranPrice float64 `json:"tranPrice"`
TranShares float64 `json:"tranShares"`
TranValue float64 `json:"tranValue"`
}
// InstitutionalOwnership struct
type InstitutionalOwnership []struct {
AdjHolding int `json:"adjHolding"`
AdjMv int `json:"adjMv"`
EntityProperName string `json:"entityProperName"`
ReportDate int64 `json:"reportDate"`
ReportedHolding int `json:"reportedHolding"`
}
// IntradayPricesQueryParams required/optional query parameters
type IntradayPricesQueryParams struct {
// ChartIEXOnly true limits to IEX only data
ChartIEXOnly bool `url:"chartIEXOnly,omitempty"`
// ChartReset true resets chart at midnight instead of 9:30 AM ET
ChartReset bool `url:"chartReset,omitempty"`
ChartSimplify bool `url:"chartSimplify,omitempty"`
ChartInterval uint `url:"chartInterval,omitempty"`
ChangeFromClose bool `url:"changeFromClose,omitempty"`
ChartLast uint `url:"chartLast,omitempty"`
// ExactDate date formatted as YYYYMMDD
ExactDate string `url:"exactDate,omitempty"`
ChartIEXWhenNull bool `url:"chartIEXWhenNull,omitempty"`
}
// IntradayPrices struct
type IntradayPrices []struct {
Date string `json:"date"`
Minute string `json:"minute"`
Label string `json:"label"`
MarketOpen float64 `json:"marketOpen"`
MarketClose float64 `json:"marketClose"`
MarketHigh float64 `json:"marketHigh"`
MarketLow float64 `json:"marketLow"`
MarketAverage float64 `json:"marketAverage"`
MarketVolume int `json:"marketVolume"`
MarketNotional float64 `json:"marketNotional"`
MarketNumberOfTrades int `json:"marketNumberOfTrades"`
MarketChangeOverTime float64 `json:"marketChangeOverTime"`
High float64 `json:"high"`
Low float64 `json:"low"`
Open float64 `json:"open"`
Close float64 `json:"close"`
Average float64 `json:"average"`
Volume int `json:"volume"`
Notional float64 `json:"notional"`
NumberOfTrades int `json:"numberOfTrades"`
ChangeOverTime float64 `json:"changeOverTime"`
}
// IPOCalendar struct
type IPOCalendar struct {
RawData []struct {
Symbol string `json:"symbol"`
CompanyName string `json:"companyName"`
ExpectedDate string `json:"expectedDate"`
LeadUnderwriters []string `json:"leadUnderwriters"`
Underwriters []string `json:"underwriters"`
CompanyCounsel []string `json:"companyCounsel"`
UnderwriterCounsel []string `json:"underwriterCounsel"`
Auditor string `json:"auditor"`
Market string `json:"market"`
Cik string `json:"cik"`
Address string `json:"address"`
City string `json:"city"`
State string `json:"state"`
Zip string `json:"zip"`
Phone string `json:"phone"`
Ceo string `json:"ceo"`
Employees int `json:"employees"`
URL string `json:"url"`
Status string `json:"status"`
SharesOffered int `json:"sharesOffered"`
PriceLow float64 `json:"priceLow"`
PriceHigh float64 `json:"priceHigh"`
OfferAmount interface{} `json:"offerAmount"`
TotalExpenses float64 `json:"totalExpenses"`
SharesOverAlloted int `json:"sharesOverAlloted"`
ShareholderShares interface{} `json:"shareholderShares"`
SharesOutstanding int `json:"sharesOutstanding"`
LockupPeriodExpiration string `json:"lockupPeriodExpiration"`
QuietPeriodExpiration string `json:"quietPeriodExpiration"`
Revenue int `json:"revenue"`
NetIncome int `json:"netIncome"`
TotalAssets int `json:"totalAssets"`
TotalLiabilities int `json:"totalLiabilities"`
StockholderEquity int `json:"stockholderEquity"`
CompanyDescription string `json:"companyDescription"`
BusinessDescription string `json:"businessDescription"`
UseOfProceeds string `json:"useOfProceeds"`
Competition string `json:"competition"`
Amount int `json:"amount"`
PercentOffered string `json:"percentOffered"`
} `json:"rawData"`
ViewData []struct {
Company string `json:"Company"`
Symbol string `json:"Symbol"`
Price string `json:"Price"`
Shares string `json:"Shares"`
Amount string `json:"Amount"`
Float string `json:"Float"`
Percent string `json:"Percent"`
Market string `json:"Market"`
Expected string `json:"Expected"`
} `json:"viewData"`
}
// KeyStat struct
type KeyStat struct {
CompanyName string `json:"companyName"`
Marketcap int64 `json:"marketcap"`
Week52High float64 `json:"week52high"`
Week52Low float64 `json:"week52low"`
Week52Change float64 `json:"week52change"`
SharesOutstanding int64 `json:"sharesOutstanding"`
Float float64 `json:"float"`
Symbol string `json:"symbol"`
Avg10Volume float64 `json:"avg10Volume"`
Avg30Volume float64 `json:"avg30Volume"`
Day200MovingAvg float64 `json:"day200MovingAvg"`
Day50MovingAvg float64 `json:"day50MovingAvg"`
Employees int `json:"employees"`
TtmEPS float64 `json:"ttmEPS"`
TtmDividendRate float64 `json:"ttmDividendRate"`
DividendYield float64 `json:"dividendYield"`
NextDividendDate string `json:"nextDividendDate"`
ExDividendDate string `json:"exDividendDate"`
NextEarningsDate string `json:"nextEarningsDate"`
PeRatio float64 `json:"peRatio"`
Beta float64 `json:"beta"`
MaxChangePercent float64 `json:"maxChangePercent"`
Year5ChangePercent float64 `json:"year5ChangePercent"`
Year2ChangePercent float64 `json:"year2ChangePercent"`
Year1ChangePercent float64 `json:"year1ChangePercent"`
YtdChangePercent float64 `json:"ytdChangePercent"`
Month6ChangePercent float64 `json:"month6ChangePercent"`
Month3ChangePercent float64 `json:"month3ChangePercent"`
Month1ChangePercent float64 `json:"month1ChangePercent"`
Day30ChangePercent float64 `json:"day30ChangePercent"`
Day5ChangePercent float64 `json:"day5ChangePercent"`
}
// LargestTrades struct
type LargestTrades []struct {
Price float64 `json:"price"`
Size int `json:"size"`
Time int64 `json:"time"`
TimeLabel string `json:"timeLabel"`
Venue string `json:"venue"`
VenueName string `json:"venueName"`
}
// ListQueryParams required/optional query parameters
type ListQueryParams struct {
DisplayPercent bool `url:"displayPercent,omitempty"`
ListLimit uint `url:"listLimit,omitempty"`
}
// Logo struct
type Logo struct {
URL string `json:"url"`
}
// MarketVolume struct
type MarketVolume []struct {
Mic string `json:"mic"`
TapeID string `json:"tapeId"`
VenueName string `json:"venueName"`
Volume int `json:"volume"`
TapeA int `json:"tapeA"`
TapeB int `json:"tapeB"`
TapeC int `json:"tapeC"`
MarketPercent float64 `json:"marketPercent"`
LastUpdated int64 `json:"lastUpdated"`
}
// News struct
type News []struct {
Datetime int64 `json:"datetime"`
Headline string `json:"headline"`
Source string `json:"source"`
URL string `json:"url"`
Summary string `json:"summary"`
Related string `json:"related"`
Image string `json:"image"`
Lang string `json:"lang"`
HasPaywall bool `json:"hasPaywall"`
}
// OHLC struct
type OHLC struct {
Open struct {
Price float64 `json:"price"`
Time int64 `json:"time"`
} `json:"open"`
Close struct {
Price float64 `json:"price"`
Time int64 `json:"time"`
} `json:"close"`
High float64 `json:"high"`
Low float64 `json:"low"`
}
// Option struct
type Option struct {
Symbol string `json:"symbol"`
ID string `json:"id"`
ExpirationDate string `json:"expirationDate"`
ContractSize int `json:"contractSize"`
StrikePrice float64 `json:"strikePrice"`
ClosingPrice float64 `json:"closingPrice"`
Side string `json:"side"`
Type string `json:"type"`
Volume int `json:"volume"`
OpenInterest int `json:"openInterest"`
Bid float64 `json:"bid"`
Ask float64 `json:"ask"`
LastUpdated string `json:"lastUpdated"`
}
// PreviousDayPrice struct
type PreviousDayPrice struct {
Date string `json:"date"`
Open float64 `json:"open"`
Close float64 `json:"close"`
High float64 `json:"high"`
Low float64 `json:"low"`
Volume float64 `json:"volume"`
UOpen float64 `json:"uOpen"`
UClose float64 `json:"uClose"`
UHigh float64 `json:"uHigh"`
ULow float64 `json:"uLow"`
UVolume float64 `json:"uVolume"`
Change float64 `json:"change"`
ChangePercent float64 `json:"changePercent"`
ChangeOverTime float64 `json:"changeOverTime"`
Symbol string `json:"symbol"`
}
// PriceTarget struct
type PriceTarget struct {
Symbol string `json:"symbol"`
UpdatedDate string `json:"updatedDate"`
PriceTargetAverage float64 `json:"priceTargetAverage"`
PriceTargetHigh float64 `json:"priceTargetHigh"`
PriceTargetLow float64 `json:"priceTargetLow"`
NumberOfAnalysts int `json:"numberOfAnalysts"`
}
// QuoteQueryParams required/optional query parameters
type QuoteQueryParams struct {
DisplayPercent bool `url:"displayPercent,omitempty"`
}
// Quote struct
type Quote struct {
Symbol string `json:"symbol"`
CompanyName string `json:"companyName"`
CalculationPrice string `json:"calculationPrice"`
Open float64 `json:"open"`
OpenTime int64 `json:"openTime"`
Close float64 `json:"close"`
CloseTime int64 `json:"closeTime"`
High float64 `json:"high"`
Low float64 `json:"low"`
LatestPrice float64 `json:"latestPrice"`
LatestSource string `json:"latestSource"`
LatestTime string `json:"latestTime"`
LatestUpdate int64 `json:"latestUpdate"`
LatestVolume int `json:"latestVolume"`
IexRealtimePrice float64 `json:"iexRealtimePrice"`
IexRealtimeSize int `json:"iexRealtimeSize"`
IexLastUpdated int64 `json:"iexLastUpdated"`
DelayedPrice float64 `json:"delayedPrice"`
DelayedPriceTime int64 `json:"delayedPriceTime"`
ExtendedPrice float64 `json:"extendedPrice"`
ExtendedChange float64 `json:"extendedChange"`
ExtendedChangePercent float64 `json:"extendedChangePercent"`
ExtendedPriceTime int64 `json:"extendedPriceTime"`
PreviousClose float64 `json:"previousClose"`
Change float64 `json:"change"`
ChangePercent float64 `json:"changePercent"`
IexMarketPercent float64 `json:"iexMarketPercent"`
IexVolume int `json:"iexVolume"`
AvgTotalVolume int `json:"avgTotalVolume"`
IexBidPrice float64 `json:"iexBidPrice"`
IexBidSize int `json:"iexBidSize"`
IexAskPrice float64 `json:"iexAskPrice"`
IexAskSize int `json:"iexAskSize"`
MarketCap int64 `json:"marketCap"`
Week52High float64 `json:"week52High"`
Week52Low float64 `json:"week52Low"`
YtdChange float64 `json:"ytdChange"`
}
// RecommendationTrends struct
type RecommendationTrends []struct {