This repository has been archived by the owner on Jul 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 53
/
iexdata.go
137 lines (123 loc) · 5.08 KB
/
iexdata.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
// Copyright (c) 2019-2024 The iexcloud developers. All rights reserved.
// Project site: https://github.com/goinvest/iexcloud
// Use of this source code is governed by a MIT-style license that
// can be found in the LICENSE file for the project.
package iex
// Last provides trade data for executions on IEX. It is a near real time,
// intraday API that provides IEX last sale price, size and time. Last is ideal
// for developers that need a lightweight stock quote.
type Last struct {
Symbol string `json:"symbol"`
Price float64 `json:"Price"`
Size int `json:"Size"`
Time EpochTime `json:"time"`
}
// Records models the stats records.
type Records struct {
Volume VolumeRecord `json:"volume"`
}
// TOPS contains IEX's aggregated best quoted bid and offer position in near
// real time for all securities on IEX's displayed limit order book.
type TOPS struct {
Symbol string `json:"symbol"`
MarketPercent float64 `json:"marketPercent"`
BidSize int `json:"bidSize"`
BidPrice float64 `json:"bidPrice"`
AskSize int `json:"AskSize"`
AskPrice float64 `json:"AskPrice"`
Volume int `json:"volume"`
LastSalePrice float64 `json:"lastSalePrice"`
LastSaleTime EpochTime `json:"lastSaleTime"`
LastUpdated EpochTime `json:"lastUpdated"`
Sector string `json:"sector"`
SecurityType string `json:"securityType"`
}
// DEEP is used to receive real-time depth of book quotations direct from IEX.
// The depth of book quotations received via DEEP provide an aggregated size of
// resting displayed orders at a price and side, and do not indicate the size or
// number of individual orders at any price level.
type DEEP struct {
Symbol string `json:"symbol"`
MarketPercent float64 `json:"marketPercent"`
Volume int `json:"volume"`
LastSalePrice float64 `json:"lastSalePrice"`
LastSaleSize int `json:"lastSaleSize"`
LastSaleTime EpochTime `json:"lastSaleTime"`
LastUpdated EpochTime `json:"lastUpdated"`
Bids []BidAsk `json:"bids"`
Asks []BidAsk `json:"asks"`
SystemEvent SystemEvent `json:"systemEvent"`
TradingStatus TradingStatus `json:"tradingStatus"`
OpHaltStatus OpHaltStatus `json:"opHaltStatus"`
SSRStatus SSRStatus `json:"ssrStatus"`
SecurityEvent SecurityEvent `json:"securityEvent"`
Trades []Trade `json:"trades"`
TradeBreaks []Trade `json:"tradeBreaks"`
Auction Auction `json:"auction"`
}
// Auction models auction data for a security
type Auction struct {
AuctionType string `json:"auctionType"`
PairedShares int `json:"pairedShares"`
ImbalanceShares int `json:"imbalanceShares"`
ReferencePrice float64 `json:"referencePrice"`
IndicativePrice float64 `json:"indicativePrice"`
AuctionBookPrice float64 `json:"auctionBookPrice"`
CollarReferencePrice float64 `json:"collarReferencePrice"`
LowerCollarPrice float64 `json:"lowerCollarPrice"`
UpperCollarPrice float64 `json:"upperCollarPrice"`
ExtensionNumber int `json:"extensionNumber"`
StartTime EpochTime `json:"startTime"`
LastUpdate EpochTime `json:"lastUpdate"`
}
// DEEPBook contains just the bids and asks for a specified symbol
type DEEPBook struct {
Bids []BidAsk `json:"bids"`
Asks []BidAsk `json:"asks"`
}
// OpHaltStatus models the operational halt status of a security
type OpHaltStatus struct {
IsHalted bool `json:"isHalted"`
Timestamp EpochTime `json:"timestamp"`
}
// SecurityEvent models events which apply to a specific security
type SecurityEvent struct {
SecurityEvent string `json:"securityEvent"`
Timestamp EpochTime `json:"timestamp"`
}
// SSRStatus models the short sale price test status for a security
type SSRStatus struct {
IsSSR bool `json:"isSSR"`
Detail string `json:"detail"`
Timestamp EpochTime `json:"timestamp"`
}
// SystemEvent models a system event for a quote.
type SystemEvent struct {
SystemEvent string `json:"systemEvent"`
Timestamp EpochTime `json:"timestamp"`
}
// Trade models a trade for a quote.
type Trade struct {
Price float64 `json:"price"`
Size int `json:"size"`
TradeID int `json:"tradeId"`
IsISO bool `json:"isISO"`
IsOddLot bool `json:"isOddLot"`
IsOutsideRegularHours bool `json:"isOutsideRegularHours"`
IsSinglePriceCross bool `json:"isSinglePriceCross"`
IsTradeThroughExempt bool `json:"isTradeThroughExempt"`
Timestamp EpochTime `json:"timestamp"`
}
// TradingStatus models the current trading status of a security
type TradingStatus struct {
Status string `json:"status"`
Reason string `json:"reason"`
Timestamp EpochTime `json:"timestamp"`
}
// VolumeRecord models the record volume.
type VolumeRecord struct {
Value float64 `json:"recordValue"`
Date Date `json:"recordDate"`
PreviousDayValue float64 `json:"previousDayValue"`
Avg30Value float64 `json:"avg30Value"`
}