This library provides very simple and Swiftly way to interact with Yahoo Finance REST API.
- 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.
- File > Swift Packages > Add Package Dependency
- Add https://github.com/alfianlosari/XCAStocksAPI.git
- Select "Main" branch
First of all, you need to import and initalize the XCAStocksAPI
.
import XCAStocksAPI
let api = XCAStocksAPI()
let apple1dChart = try await api.fetchChartData(tickerSymbol: "AAPL", range: .oneDay)
let tickers = try await api.searchTickers(query: "TESLA")
let quotes = try await api.fetchQuotes(symbols: "AAPL,TSLA,GOOG,MSFT")