Swift wrapper for Yahoo Finance REST API

XCAStocksAPI

This library provides very simple and Swiftly way to interact with Yahoo Finance REST API.`

Features

  • Fetch Chart data for 1d, 1w, 1mo, 3mo, 6mo, 1y, 2y, 5y, YTD, max.
  • Search Ticker using query.
  • Fetch quotes using ticker symbols.
  • Swift Async Await Interface.
  • Fetch Raw JSON data.

Swift Package Manager

Example

Initialize repository

First of all, you need to import and initalize the XCAStocksAPI.

import XCAStocksAPI

let api = XCAStocksAPI.shared

Fetch AAPL stocks last 1 day

let apple1dChart = try await api.fetchChartData(tickerSymbol: "AAPL", range: .oneDay)

Search Ticker using “TESLA” as Query

let tickers = try await api.searchTicker(query: "TESLA")

Fetch Quote Detail for multiple symbols AAPL, TSLA, GOOG, MSFT

let quotes = try await api.fetchQuotes(symbols: "AAPL,TSLA,GOOG,MSFT")

Powered by Yahoo Finance API

https://www.yahoo.com/?ilc=401

GitHub

View Github