Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Dec 8, 2025. It is now read-only.

Lewis-Fam/Stocks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

44 Commits

Repository files navigation

LewisFam.Stocks

LewisFam.Stocks is a fast, free and simple stock and option prices API written in C#. This API can easily be intergrated into any .NET project.

Features

  • Fast and Free!
  • Free real-time stock quotes from Cnbc & Webull
  • Free real-time stock option prices from Webull
  • .NET Cross-Platform

Installation

LewisFam.Stocks is free and open source comman class libary using.

Install-Package LewisFam.Stocks
dotnet add package LewisFam.Stocks

Usage

StocksUtil

using LewisFam.Stocks;
var stock = await StocksUtil.FindStockAsync("MSFT"); //find
//Multiple quotes.
var stockList = new List<Stock>();
stockList.Add(stock);
//stockList.Add(someOtherStock);
var quotes = await StocksUtil.GetRealTimeMarketQuotesAsync(stockList);
////or extension method.
//quotes = await stockList.GetGetRealTimeMarketQuotesAsync();
var quote = await StocksUtil.GetRealTimeMarketQuoteAsync(stock);
////or extension method.
//quote = await stock.GetRealTimeMarketQuoteAsync();
Stock Options
var options = await StocksUtil.GetAllStockOptionsAsync(stock.TickerId);
////or extension method.
//options = await stock.GetAllStockOptionsAsync();

Dependency Injection

Startup.cs

using LewisFam.Stocks.ThirdParty.Cnbc;
using LewisFam.Stocks.ThirdParty.Services;
using LewisFam.Stocks.ThirdParty.Webull;
public class Startup { 
public void ConfigureServices(IServiceCollection services)
{ 
 //..
 services.AddTransient<IWebullDataService, WebullDataService>(); 
 services.AddTransient<ICnbcDataService, CnbcDataService>(); 
 
 //services.AddControllersWithViews(); 
 //services.AddRazorPages();
 //..
}
}

SampleStocksController.cs

using LewisFam.Stocks.ThirdParty.Services;
using LewisFam.Stocks.ThirdParty.Webull;
public class SampleStockController : Controller
{
 private readonly IWebullDataService _webull;
 public SampleStockController(IWebullDataService webull)
 {
 _webull = webull;
 }
 public async Task<IActionResult> GetAllOptions(long tickerId)
 {
 var data = await _webulll.GetAllStockOptionsAsync(tickerId);
 if (data == null) return BadRequest(tickerId);
 return View(data);
 }
}

Demo / Tests

LewisFam.Stocks.Test

Tech & Requirements

The LewisFam library uses a number of open source projects to work properly:

  • .NET
  • Web access
  • LewisFam.Common - a free and open source common library.
  • Cnbc - Real-Time stock quotes.
  • Webull - Real-Time stock quotes and option prices.

And of course LewisFam.Stocks itself is open source with a public repository on GitHub.

License

MIT

Free Software, Yay!

Version

v1.0.6

About

A fast, free and simple stock and option prices API. This API can easily be integrated into any .NET project.

Topics

Resources

License

Stars

Watchers

Forks

Contributors

AltStyle によって変換されたページ (->オリジナル) /