Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/m3o-apis/stock-go

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/m3o-apis/stock-go

  • v0.0.0-20211027120808-8f54f7eee8df
  • Source
  • Go
  • Socket score

Version published
Created
Source

Stock

An m3o.com API. For example usage see m3o.com/Stock/api.

Endpoints:

Price

Get the last price for a given stock ticker

https://m3o.com/stock/api#Price

package example

import(
	"fmt"
	"os"

	"github.com/micro/services/clients/go/stock"
)

// Get the last price for a given stock ticker
func GetAstockPrice() {
	stockService := stock.NewStockService(os.Getenv("M3O_API_TOKEN"))
	rsp, err := stockService.Price(&stock.PriceRequest{
		Symbol: "AAPL",

	})
	fmt.Println(rsp, err)
}

Quote

Get the last quote for the stock

https://m3o.com/stock/api#Quote

package example

import(
	"fmt"
	"os"

	"github.com/micro/services/clients/go/stock"
)

// Get the last quote for the stock
func GetAstockQuote() {
	stockService := stock.NewStockService(os.Getenv("M3O_API_TOKEN"))
	rsp, err := stockService.Quote(&stock.QuoteRequest{
		Symbol: "AAPL",

	})
	fmt.Println(rsp, err)
}

History

Get the historic open-close for a given day

https://m3o.com/stock/api#History

package example

import(
	"fmt"
	"os"

	"github.com/micro/services/clients/go/stock"
)

// Get the historic open-close for a given day
func GetHistoricData() {
	stockService := stock.NewStockService(os.Getenv("M3O_API_TOKEN"))
	rsp, err := stockService.History(&stock.HistoryRequest{
		Date: "2020-10-01",
Stock: "AAPL",

	})
	fmt.Println(rsp, err)
}

OrderBook

Get the historic order book and each trade by timestamp

https://m3o.com/stock/api#OrderBook

package example

import(
	"fmt"
	"os"

	"github.com/micro/services/clients/go/stock"
)

// Get the historic order book and each trade by timestamp
func OrderBookHistory() {
	stockService := stock.NewStockService(os.Getenv("M3O_API_TOKEN"))
	rsp, err := stockService.OrderBook(&stock.OrderBookRequest{
		Date: "2020-10-01",
End: "2020-10-01T11:00:00Z",
Limit: 3,
Start: "2020-10-01T10:00:00Z",
Stock: "AAPL",

	})
	fmt.Println(rsp, err)
}

FAQs

Package last updated on 27 Oct 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc