github.com/polygon-io/client-go@v1.16.4/rest/models/conditions.go (about)

     1  package models
     2  
     3  // ListConditionsParams is the set of parameters for the ListConditions method.
     4  type ListConditionsParams struct {
     5  	// Filter for conditions within a given asset class.
     6  	AssetClass *AssetClass `query:"asset_class,omitempty"`
     7  
     8  	// Filter by data type.
     9  	DataType *DataType `query:"data_type,omitempty"`
    10  
    11  	// Filter for conditions with a given ID.
    12  	ID *int64 `query:"id,omitempty"`
    13  
    14  	// Filter by SIP. If the condition contains a mapping for that SIP, the condition will be returned.
    15  	SIP *SIP `query:"sip,omitempty"`
    16  
    17  	// Order results based on the sort field.
    18  	Order *Order `query:"order"`
    19  
    20  	// Limit the number of results returned, default is 10 and max is 1000.
    21  	Limit *int `query:"limit"`
    22  
    23  	// Sort field used for ordering.
    24  	Sort *Sort `query:"sort"`
    25  }
    26  
    27  func (p ListConditionsParams) WithAssetClass(q AssetClass) *ListConditionsParams {
    28  	p.AssetClass = &q
    29  	return &p
    30  }
    31  
    32  func (p ListConditionsParams) WithDataType(q DataType) *ListConditionsParams {
    33  	p.DataType = &q
    34  	return &p
    35  }
    36  
    37  func (p ListConditionsParams) WithID(q int64) *ListConditionsParams {
    38  	p.ID = &q
    39  	return &p
    40  }
    41  
    42  func (p ListConditionsParams) WithSIP(q SIP) *ListConditionsParams {
    43  	p.SIP = &q
    44  	return &p
    45  }
    46  
    47  func (p ListConditionsParams) WithOrder(q Order) *ListConditionsParams {
    48  	p.Order = &q
    49  	return &p
    50  }
    51  
    52  func (p ListConditionsParams) WithLimit(q int) *ListConditionsParams {
    53  	p.Limit = &q
    54  	return &p
    55  }
    56  
    57  func (p ListConditionsParams) WithSort(q Sort) *ListConditionsParams {
    58  	p.Sort = &q
    59  	return &p
    60  }
    61  
    62  // ListConditionsResponse is the response returned by the ListConditions method.
    63  type ListConditionsResponse struct {
    64  	BaseResponse
    65  	Results []Condition `json:"results,omitempty"`
    66  }
    67  
    68  // Condition contains detailed information on a specified condition.
    69  type Condition struct {
    70  	Abbreviation string      `json:"abbreviation,omitempty"`
    71  	AssetClass   string      `json:"asset_class,omitempty"`
    72  	DataTypes    []string    `json:"data_types,omitempty"`
    73  	Description  string      `json:"description,omitempty"`
    74  	Exchange     int64       `json:"exchange,omitempty"`
    75  	ID           int64       `json:"id,omitempty"`
    76  	Legacy       bool        `json:"legacy"`
    77  	Name         string      `json:"name,omitempty"`
    78  	SIPMapping   SIPMapping  `json:"sip_mapping,omitempty"`
    79  	Type         string      `json:"type,omitempty"`
    80  	UpdateRules  UpdateRules `json:"update_rules,omitempty"`
    81  }
    82  
    83  // SIPMapping maps a condition to symbols for each SIP.
    84  type SIPMapping struct {
    85  	CTA  string `json:"CTA,omitempty"`
    86  	OPRA string `json:"OPRA,omitempty"`
    87  	UTP  string `json:"UTP,omitempty"`
    88  }
    89  
    90  // UpdateRules is a list of aggregation rules.
    91  type UpdateRules struct {
    92  	Consolidated struct {
    93  		UpdatesHighLow   bool `json:"updates_high_low,omitempty"`
    94  		UpdatesOpenClose bool `json:"updates_open_close,omitempty"`
    95  		UpdatesVolume    bool `json:"updates_volume,omitempty"`
    96  	} `json:"consolidated,omitempty"`
    97  	MarketCenter struct {
    98  		UpdatesHighLow   bool `json:"updates_high_low,omitempty"`
    99  		UpdatesOpenClose bool `json:"updates_open_close,omitempty"`
   100  		UpdatesVolume    bool `json:"updates_volume,omitempty"`
   101  	} `json:"market_center,omitempty"`
   102  }