Latest 0.1.0
Homepage https://github.com/halvorsen/GoogleStocks
License MIT
Platforms ios 8.0
Frameworks UIKit, Foundation
Authors

CI Status
Version
License
Platform

DynamicButton

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

import GoogleStocks

v 0.1.0 includes two functions to retrieve historical data and a stock’s current price. There is an example graph in the example project:

Historical prices

historicalPrices(years: Int, ticker: String, result: @escaping (_ stockDataTuple:([Double]?,[(String,Int,Int)]?,Error?)) -> Void)

For Example:

StockPrices.shared.historicalPrices(years: 10, ticker: "TSLA") { (_stockData,_dates,error) in
if error != nil {
print(error?.localizedDescription)
} else {
guard let stockData = _stockData else {return}
guard let dates = _dates else {return}
print("Stock Prices As Doubles::::")
print(stockData)
print("Stock Prices As Strings::::")
print(stockData.map {"$" + String(format: "%.02f", $0)})
print("Stock Dates::::")
print(dates)
}

Current price displays current value when stock market is open, last closing price if it is closed

currentPrice(ticker: String, done: @escaping ((Double,String,Int,Int)?,Error?) -> Void)

For Example:

StockPrices.shared.currentPrice(ticker: "TSLA") { (tuple, error) in

if error != nil {
print(error!.localizedDescription)
} else {
guard let (price, month, day, year) = tuple else {return}

print("Stock Prices As Double::::")
print(price)
print("Stock Price As String::::")
print("$" + String(format: "%.02f", price))
print("Stock Date::::")
print("(month) (day), (year)")
}
}

*GoogleStocks is meant for personal use and not production use, here is the cheapest option I’ve found for production:
Intrinio.com, $250/month for up to 100,000 api calls/day for startups.

Requirements

Installation

GoogleStocks is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "GoogleStocks"

Author

halvorsen, “[email protected]
git config –global user.name “halvorsen

License

GoogleStocks is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "GoogleStocks",
    "version": "0.1.0",
    "summary": "A framework for fetching stock information from the Google Finance API.",
    "description": "Google Stocks v0.1.0 allows one to fetch current market price (or last closing price if market is closed) as well as 10 years of historical prices for NYSE, NASDAQ, AMEX, OTCMKTS stocks. 1 month graph is displayed in the example project.",
    "homepage": "https://github.com/halvorsen/GoogleStocks",
    "screenshots": "http://aaronhalvorsen.com/resources/GoogleStocks.gif",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Halvorsen": "[email protected] config --global user.name  u201chalvorsen"
    },
    "source": {
        "git": "https://github.com/halvorsen/GoogleStocks.git",
        "tag": "0.1.0"
    },
    "social_media_url": "https://twitter.com/halvoh",
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "GoogleStocks/Classes/**/*",
    "frameworks": [
        "UIKit",
        "Foundation"
    ],
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This