stonks

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 31, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

* Copyright 2021 M1K * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2021 M1K * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCode

func GetCode(ticker, contractType, day, month, year string, price float32) string

func GetCrypto

func GetCrypto(coin string, isThisARetry bool) (float32, error)

func GetOption

func GetOption(ticker, contractType, day, month, year string, price, last float32) (float32, string, error)

func GetOptionYahoo

func GetOptionYahoo(ticker, contractType, day, month, year string, price float32) (float32, string, error)

func GetStock

func GetStock(stock string) (float32, error)

Types

type LastQuoteResponse

type LastQuoteResponse struct {
	RequestID string `json:"request_id"`
	Results   struct {
		T  string  `json:"T"`
		C  []int   `json:"c"`
		F  int64   `json:"f"`
		I  string  `json:"i"`
		P  float64 `json:"p"`
		Q  int     `json:"q"`
		R  int     `json:"r"`
		S  int     `json:"s"`
		T_ int64   `json:"t"`
		X  int     `json:"x"`
	} `json:"results"`
	Status string `json:"status"`
}

type LastTradeOptionsResponse

type LastTradeOptionsResponse struct {
	RequestID string `json:"request_id"`
	Results   struct {
		BreakEvenPrice float64 `json:"break_even_price"`
		Day            struct {
			Close         float64 `json:"close"`
			High          float64 `json:"high"`
			LastUpdated   int64   `json:"last_updated"`
			Low           float64 `json:"low"`
			Open          float64 `json:"open"`
			PreviousClose float64 `json:"previous_close"`
			Volume        int     `json:"volume"`
			Vwap          float64 `json:"vwap"`
		} `json:"day"`
		Details struct {
			ContractType      string `json:"contract_type"`
			ExerciseStyle     string `json:"exercise_style"`
			ExpirationDate    string `json:"expiration_date"`
			SharesPerContract int    `json:"shares_per_contract"`
			StrikePrice       int    `json:"strike_price"`
			Ticker            string `json:"ticker"`
		} `json:"details"`
		Greeks struct {
			Delta float64 `json:"delta"`
			Gamma float64 `json:"gamma"`
			Theta float64 `json:"theta"`
			Vega  float64 `json:"vega"`
		} `json:"greeks"`
		ImpliedVolatility float64 `json:"implied_volatility"`
		LastQuote         struct {
			Ask         float64 `json:"ask"`
			AskSize     int     `json:"ask_size"`
			Bid         float64 `json:"bid"`
			BidSize     int     `json:"bid_size"`
			LastUpdated int64   `json:"last_updated"`
			Midpoint    float64 `json:"midpoint"`
			Timeframe   string  `json:"timeframe"`
		} `json:"last_quote"`
		OpenInterest    int `json:"open_interest"`
		UnderlyingAsset struct {
			ChangeToBreakEven float64 `json:"change_to_break_even"`
			LastUpdated       int64   `json:"last_updated"`
			Price             float64 `json:"price"`
			Ticker            string  `json:"ticker"`
			Timeframe         string  `json:"timeframe"`
		} `json:"underlying_asset"`
	} `json:"results"`
	Status string `json:"status"`
}

type Snapshot

type Snapshot struct {
	RequestID string `json:"request_id"`
	Results   struct {
		BreakEvenPrice float64 `json:"break_even_price"`
		Day            struct {
			Close         float64 `json:"close"`
			High          float64 `json:"high"`
			LastUpdated   int64   `json:"last_updated"`
			Low           float64 `json:"low"`
			Open          float64 `json:"open"`
			PreviousClose float64 `json:"previous_close"`
			Volume        int     `json:"volume"`
			Vwap          float64 `json:"vwap"`
		} `json:"day"`
		Details struct {
			ContractType      string  `json:"contract_type"`
			ExerciseStyle     string  `json:"exercise_style"`
			ExpirationDate    string  `json:"expiration_date"`
			SharesPerContract int     `json:"shares_per_contract"`
			StrikePrice       float64 `json:"strike_price"`
			Ticker            string  `json:"ticker"`
		} `json:"details"`
		Greeks struct {
			Delta float64 `json:"delta"`
			Gamma float64 `json:"gamma"`
			Theta float64 `json:"theta"`
			Vega  float64 `json:"vega"`
		} `json:"greeks"`
		ImpliedVolatility float64 `json:"implied_volatility"`
		LastQuote         struct {
			Ask         float64 `json:"ask"`
			AskSize     int     `json:"ask_size"`
			Bid         float64 `json:"bid"`
			BidSize     int     `json:"bid_size"`
			LastUpdated int64   `json:"last_updated"`
			Midpoint    float64 `json:"midpoint"`
			Timeframe   string  `json:"timeframe"`
		} `json:"last_quote"`
		OpenInterest    int `json:"open_interest"`
		UnderlyingAsset struct {
			ChangeToBreakEven float64 `json:"change_to_break_even"`
			LastUpdated       int64   `json:"last_updated"`
			Price             float64 `json:"price"`
			Ticker            string  `json:"ticker"`
			Timeframe         string  `json:"timeframe"`
		} `json:"underlying_asset"`
	} `json:"results"`
	Status string `json:"status"`
}

func GetOptionAdvanced

func GetOptionAdvanced(ticker, contractType, day, month, year string, price float32) (*Snapshot, string, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL