XCAStocksAPI

main

Swift wrapper for Yahoo Finance REST API
alfianlosari/XCAStocksAPI

XCAStocksAPI

Alt text

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()

Fetch AAPL stocks last 1 day

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

Search Tickers using "TESLA" as Query

let tickers = try await api.searchTickers(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

Description

  • Swift Tools 5.6.0
View More Packages from this Author

Dependencies

  • None
Last updated: Sat Oct 31 2026 06:17:33 GMT-0900 (Hawaii-Aleutian Daylight Time)