├── .gitignore ├── .rspec ├── .travis.yml ├── CODE_OF_CONDUCT.md ├── Gemfile ├── LICENSE.txt ├── README.md ├── Rakefile ├── alphavantage.gemspec ├── bin ├── console └── setup ├── lib ├── alphavantage.rb └── alphavantage │ ├── client.rb │ ├── configuration.rb │ ├── crypto.rb │ ├── error.rb │ ├── forex.rb │ ├── fundamental.rb │ ├── indicator.rb │ ├── normalize_key.rb │ ├── time_series.rb │ ├── validations.rb │ └── version.rb └── spec ├── alphavantage ├── client_spec.rb ├── configuration_spec.rb ├── crypto_spec.rb ├── forex_spec.rb ├── fundamental_spec.rb ├── indicator_spec.rb ├── normalize_key_spec.rb └── time_series_spec.rb ├── alphavantage_spec.rb ├── fixtures ├── crypto │ ├── daily.json │ ├── health_index.json │ ├── intraday.json │ ├── monthly.json │ └── weekly.json ├── forex │ ├── daily.json │ ├── exchange_rates.json │ ├── intraday.json │ ├── monthly.json │ └── weekly.json ├── fundamental │ ├── balance_sheet.json │ ├── cash_flow.json │ ├── company_overview.json │ ├── earnings.json │ └── income_statement.json ├── indicator │ ├── bop.json │ ├── ema.json │ ├── macd.json │ ├── sma.json │ ├── stoch.json │ └── vwap.json └── time_series │ ├── daily.json │ ├── daily_adjusted.json │ ├── intraday.csv │ ├── intraday.json │ ├── intraday_extended_history.csv │ ├── monthly.json │ ├── monthly_adjusted.json │ ├── quote.json │ ├── search.json │ ├── weekly.json │ └── weekly_adjusted.json ├── spec_helper.rb └── support └── file_fixture.rb /.gitignore: -------------------------------------------------------------------------------- 1 | /.bundle/ 2 | /.yardoc 3 | /_yardoc/ 4 | /coverage/ 5 | /doc/ 6 | /pkg/ 7 | /spec/reports/ 8 | /tmp/ 9 | 10 | # rspec failure tracking 11 | .rspec_status 12 | 13 | .byebug_history 14 | .DS_Store 15 | .ruby-version 16 | *.gem 17 | Gemfile.lock 18 | -------------------------------------------------------------------------------- /.rspec: -------------------------------------------------------------------------------- 1 | --format documentation 2 | --color 3 | --require spec_helper 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | sudo: false 3 | language: ruby 4 | cache: bundler 5 | rvm: 6 | - 2.6.3 7 | before_install: gem install bundler -v 1.17.2 8 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, gender identity and expression, level of experience, 9 | nationality, personal appearance, race, religion, or sexual identity and 10 | orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at [http://contributor-covenant.org/version/1/4][version] 72 | 73 | [homepage]: http://contributor-covenant.org 74 | [version]: http://contributor-covenant.org/version/1/4/ 75 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | 3 | git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } 4 | 5 | # Specify your gem's dependencies in alphavantage_ruby.gemspec 6 | gemspec 7 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2021 Adrian Teh 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Gem Version](https://badge.fury.io/rb/alphavantage.svg)](https://badge.fury.io/rb/alphavantage) 2 | # Alpha Vantage Ruby Library 3 | 4 | The Alpha Vantage Ruby library provides convenient access to the [Alpha Vantage API](https://www.alphavantage.co/documentation/) from applications written in the Ruby language. 5 | 6 | ## Installation 7 | 8 | Add this line to your application's Gemfile: 9 | 10 | ```ruby 11 | gem 'alphavantage' 12 | ``` 13 | 14 | And then execute: 15 | 16 | $ bundle 17 | 18 | Or install it yourself as: 19 | 20 | $ gem install alphavantage 21 | 22 | ## Usage 23 | 24 | The library needs to be configured with your account's api key which you can obtain from https://www.alphavantage.co/support/#api-key. 25 | Set the `Alphavantage.configuration.api_key` to its value. If you are using Rails, you can configure this in an initializer. 26 | 27 | ```ruby 28 | require 'alphavantage' 29 | 30 | Alphavantage.configure do |config| 31 | config.api_key = 'your-api-key' 32 | end 33 | ``` 34 | 35 | ### Accessing a response object 36 | All JSON responses are converted to pseudo-objects that have method-like accessors for hash keys 37 | ```ruby 38 | quote = Alphavantage::TimeSeries.new(symbol: 'TSLA').quote 39 | quote.previous_close #=> "719.6900" 40 | quote.volume #=> "27879033" 41 | ``` 42 | 43 | All hash keys are also normalized to provide clean and consistent access to values since the Alphavantage API returns arbitrarily formatted keys with numbers, spaces, letters and symbols (i.e. "Crypto Rating (FCAS)", "3. fcas rating", "4. Last Refreshed", "Time Series FX (5min)", "1a. open (CNY)") 44 | 45 | With this normalization, you can now access via 46 | 47 | `intraday.time_series_fx_5min` 48 | 49 | instead of 50 | 51 | `intraday["Time Series FX (5min)"]` 52 | 53 | ### Stock Time Series 54 | 55 | ```ruby 56 | Alphavantage::TimeSeries.search(keywords: 'Tesla') 57 | 58 | stock_timeseries = Alphavantage::TimeSeries.new(symbol: 'TSLA') 59 | stock_timeseries.quote 60 | stock_timeseries.monthly 61 | stock_timeseries.monthly(adjusted: true) 62 | stock_timeseries.weekly 63 | stock_timeseries.weekly(adjusted: true) 64 | stock_timeseries.daily(outputsize: 'compact') 65 | stock_timeseries.daily(adjusted: true, outputsize: 'full') 66 | stock_timeseries.intraday(adjusted: true, outputsize: 'compact', interval: '5min') 67 | stock_timeseries.intraday_extended_history(adjusted: true, outputsize: 'compact', interval: '5min', slice: 'year1month1') 68 | ``` 69 | ### Fundamental Data 70 | ```ruby 71 | company = Alphavantage::Fundamental.new(symbol: 'TSLA') 72 | company.overview 73 | company.earnings 74 | company.income_statement 75 | company.balance_sheet 76 | company.cash_flow 77 | ``` 78 | ### Forex 79 | ```ruby 80 | forex = Alphavantage::Forex.new(from_symbol: 'USD', to_symbol: 'JPY') 81 | forex.exchange_rates 82 | forex.intraday(interval: '5min', outputsize: 'compact') 83 | forex.daily(outputsize: 'compact') 84 | forex.weekly 85 | forex.monthly 86 | ``` 87 | ### Crypto Currencies 88 | ```ruby 89 | Alphavantage::Crypto.health_index(symbol: 'BTC') 90 | 91 | crypto = Alphavantage::Crypto.new(symbol: 'BTC', market: 'USD') 92 | crypto.intraday(interval: '5min') 93 | crypto.daily 94 | crypto.weekly 95 | crypto.monthly 96 | ``` 97 | 98 | ### Technical Indicators 99 | You can access all available indicators by simply using the actual technical indicator name listed on the [Alpha Vantage Documenetation](https://www.alphavantage.co/documentation/#technical-indicators) as the method name (i.e. `.stoch`, `.rsi`, `.plus_dm`, `.ht_trendline`, etc.). 100 | 101 | You can also dig into [alphavantage/indicator.rb](https://github.com/codespore/alphavantage_ruby/blob/main/lib/alphavantage/indicator.rb) to view the list of available indicators. 102 | 103 | ```ruby 104 | indicator = Alphavantage::Indicator.new(symbol: 'TSLA', interval: '5min') 105 | indicator.sma(time_period: 7, series_type: 'close') 106 | indicator.macd(series_type: 'open', fastperiod: 12, slowperiod: 26, signalperiod: 9) 107 | 108 | indicator.macdext( 109 | series_type:, 110 | fastperiod: 12, 111 | slowperiod: 26, 112 | signalperiod: 9, 113 | fastmatype: 'sma', 114 | slowmatype: 'sma', 115 | signalmatype: 'sma' 116 | ) 117 | ``` 118 | 119 | Moving average indicator as parameters have been mapped to allow you to simply provide the actual indicator name rather than the number value specified in the Alpha Vantage Documentation. Below is the mapping available that I've used in the above `.macdext` example for the `fastmatype`, `slowmatype` and `signalmatype` parameters 120 | 121 | ```ruby 122 | MOVING_AVERAGE_TYPES = { 123 | sma: 0, 124 | ema: 1, 125 | wma: 2, 126 | dema: 3, 127 | tema: 4, 128 | trima: 5, 129 | t3: 6, 130 | kama: 7, 131 | mama: 8 132 | } 133 | ``` 134 | 135 | Validations are also implemented to ensure correct values are provided for the various parameters. You can view a list of the validations in [alphavantage/validations.rb](https://github.com/codespore/alphavantage_ruby/blob/main/lib/alphavantage/validations.rb) 136 | 137 | ### Other Functions 138 | 139 | To get functions not implemented in the gem you can use the `Alphavantage::Client` class: 140 | 141 | If you want to get the news sentiments: 142 | 143 | ```ruby 144 | Alphavantage::Client.new(function: 'NEWS_SENTIMENT').json 145 | ``` 146 | 147 | If you want to get the list of all listed US stocks and ETFs (Only supports CSV): 148 | 149 | ```ruby 150 | Alphavantage::Client.new(function: 'LISTING_STATUS').csv 151 | ``` 152 | 153 | ## Development 154 | 155 | After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. 156 | 157 | To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org). 158 | 159 | ## Contributing 160 | 161 | Bug reports and pull requests are welcome on GitHub at https://github.com/codespore/alphavantage_ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct. 162 | 163 | ## License 164 | 165 | The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). 166 | 167 | ## Code of Conduct 168 | 169 | Everyone interacting in the Alphavantage project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/codespore/alphavantage_ruby/blob/master/CODE_OF_CONDUCT.md). 170 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require "bundler/gem_tasks" 2 | require "rspec/core/rake_task" 3 | 4 | RSpec::Core::RakeTask.new(:spec) 5 | 6 | task :default => :spec 7 | -------------------------------------------------------------------------------- /alphavantage.gemspec: -------------------------------------------------------------------------------- 1 | 2 | lib = File.expand_path("../lib", __FILE__) 3 | $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) 4 | require "alphavantage/version" 5 | 6 | Gem::Specification.new do |spec| 7 | spec.name = "alphavantage" 8 | spec.version = Alphavantage::VERSION 9 | spec.authors = ["Adrian Teh"] 10 | spec.email = ["ateh.dev@gmail.com"] 11 | 12 | spec.summary = "Ruby library for Alpha Vantage API" 13 | spec.description = "Ruby library for the Alpha Vantage API, a leading provider of stock APIs as well as forex (FX) and cryptocurrency data feeds." 14 | spec.homepage = "https://github.com/codespore/alphavantage_ruby" 15 | spec.license = "MIT" 16 | 17 | # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host' 18 | # to allow pushing to a single host or delete this section to allow pushing to any host. 19 | if spec.respond_to?(:metadata) 20 | spec.metadata["homepage_uri"] = spec.homepage 21 | spec.metadata["source_code_uri"] = "https://github.com/codespore/alphavantage_ruby" 22 | spec.metadata["github_repo"] = "ssh://github.com/codespore/alphavantage_ruby" 23 | spec.metadata["bug_tracker_uri"] = "https://github.com/codespore/alphavantage_ruby/issues" 24 | else 25 | raise "RubyGems 2.0 or newer is required to protect against " \ 26 | "public gem pushes." 27 | end 28 | 29 | # Specify which files should be added to the gem when it is released. 30 | # The `git ls-files -z` loads the files in the RubyGem that have been added into git. 31 | spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do 32 | `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } 33 | end 34 | spec.bindir = "exe" 35 | spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } 36 | spec.require_paths = ["lib"] 37 | 38 | spec.add_dependency "faraday", "~> 1.4" 39 | spec.add_dependency "hashie", "~> 4.1" 40 | 41 | spec.add_development_dependency "bundler", "~> 2.2" 42 | spec.add_development_dependency "rake", ">= 12.3.3" 43 | spec.add_development_dependency "rspec", "~> 3.0" 44 | spec.add_development_dependency "webmock" 45 | spec.add_development_dependency "byebug" 46 | end 47 | -------------------------------------------------------------------------------- /bin/console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require "bundler/setup" 4 | require_relative "../lib/alphavantage" 5 | 6 | # You can add fixtures and/or initialization code here to make experimenting 7 | # with your gem easier. You can also use a different console, if you like. 8 | 9 | # (If you use this, don't forget to add pry to your Gemfile!) 10 | # require "pry" 11 | # Pry.start 12 | 13 | require "irb" 14 | IRB.start(__FILE__) 15 | -------------------------------------------------------------------------------- /bin/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | IFS=$'\n\t' 4 | set -vx 5 | 6 | bundle install 7 | 8 | # Do any other automated setup that you need to do here 9 | -------------------------------------------------------------------------------- /lib/alphavantage.rb: -------------------------------------------------------------------------------- 1 | require "faraday" 2 | require "hashie" 3 | require "alphavantage/version" 4 | require "alphavantage/error" 5 | require "alphavantage/configuration" 6 | require "alphavantage/normalize_key" 7 | require "alphavantage/client" 8 | require "alphavantage/validations" 9 | require "alphavantage/time_series" 10 | require "alphavantage/fundamental" 11 | require "alphavantage/forex" 12 | require "alphavantage/crypto" 13 | require "alphavantage/indicator" -------------------------------------------------------------------------------- /lib/alphavantage/client.rb: -------------------------------------------------------------------------------- 1 | require 'securerandom' 2 | require 'json' 3 | require 'csv' 4 | 5 | module Alphavantage 6 | class Client 7 | 8 | class << self 9 | def get(params:, datatype: :json) 10 | new(params).public_send(datatype) 11 | end 12 | end 13 | 14 | def initialize params 15 | @params = params 16 | end 17 | attr_reader :params 18 | 19 | def json 20 | Hashie::Mash.new(convert_hash_keys(JSON.parse(response.body))).tap do |response| 21 | raise Error, response.error_message if response.error_message 22 | end 23 | end 24 | 25 | def csv 26 | CSV.parse response.body 27 | rescue CSV::MalformedCSVError 28 | # if we can not parse it, we probably have JSON from API with an error 29 | json 30 | raise 31 | end 32 | 33 | private 34 | 35 | def convert_hash_keys(value) 36 | case value 37 | when Array 38 | value.map { |v| convert_hash_keys(v) } 39 | when Hash 40 | Hash[value.map { |k, v| [ NormalizeKey.new(key: k).call, convert_hash_keys(v) ] }] 41 | else 42 | value 43 | end 44 | end 45 | 46 | def response 47 | @response ||= Faraday.get('https://www.alphavantage.co/query') do |req| 48 | req.params = default_params.merge(params) 49 | end.tap do |response| 50 | next if response.status == 200 51 | 52 | raise Error, "Response status: #{response.status}, body: #{response.body}" 53 | end 54 | end 55 | 56 | def default_params 57 | { 58 | apikey: Alphavantage.configuration.api_key || raise("Api key is missing") 59 | } 60 | end 61 | end 62 | end -------------------------------------------------------------------------------- /lib/alphavantage/configuration.rb: -------------------------------------------------------------------------------- 1 | module Alphavantage 2 | class << self 3 | def configuration 4 | @configuration ||= Configuration.new 5 | end 6 | 7 | def configure 8 | yield(configuration) 9 | end 10 | end 11 | 12 | class Configuration 13 | # Allows @api_key to be a Proc, for example 14 | # as an API Key Manager or Rate Limiter. 15 | # 16 | def api_key 17 | if @api_key.is_a?(Proc) 18 | @api_key.call 19 | else 20 | @api_key 21 | end 22 | end 23 | 24 | 25 | # Typically an_object is a String but 26 | # it can also be a Proc 27 | # 28 | def api_key=(an_object) 29 | @api_key = an_object 30 | end 31 | end 32 | end 33 | -------------------------------------------------------------------------------- /lib/alphavantage/crypto.rb: -------------------------------------------------------------------------------- 1 | module Alphavantage 2 | class Crypto 3 | include Validations 4 | 5 | FUNCTIONS = { 6 | health_index: 'CRYPTO_RATING', 7 | intraday: 'CRYPTO_INTRADAY', 8 | daily: 'DIGITAL_CURRENCY_DAILY', 9 | weekly: 'DIGITAL_CURRENCY_WEEKLY', 10 | monthly: 'DIGITAL_CURRENCY_MONTHLY' 11 | } 12 | 13 | def self.health_index(symbol:) 14 | Client.get(params: { 15 | function: self::FUNCTIONS[__method__], 16 | symbol: symbol 17 | }).crypto_rating_fcas 18 | end 19 | 20 | def initialize(symbol:,market:) 21 | @symbol = symbol 22 | @market = market 23 | end 24 | 25 | def intraday(interval: '5min') 26 | Client.get(params: { 27 | function: FUNCTIONS[__method__], 28 | symbol: @symbol, 29 | market: @market, 30 | interval: validate_interval(interval) 31 | }) 32 | end 33 | 34 | def daily 35 | Client.get(params: { 36 | function: FUNCTIONS[__callee__], 37 | symbol: @symbol, 38 | market: @market 39 | }) 40 | end 41 | alias :weekly :daily 42 | alias :monthly :daily 43 | 44 | end 45 | end -------------------------------------------------------------------------------- /lib/alphavantage/error.rb: -------------------------------------------------------------------------------- 1 | module Alphavantage 2 | class Error < StandardError; end 3 | end -------------------------------------------------------------------------------- /lib/alphavantage/forex.rb: -------------------------------------------------------------------------------- 1 | module Alphavantage 2 | class Forex 3 | include Validations 4 | 5 | FUNCTIONS = { 6 | exchange_rates: 'CURRENCY_EXCHANGE_RATE', 7 | intraday: 'FX_INTRADAY', 8 | daily: 'FX_DAILY', 9 | weekly: 'FX_WEEKLY', 10 | monthly: 'FX_MONTHLY' 11 | } 12 | 13 | def initialize(from_symbol:,to_symbol:) 14 | @from_symbol = from_symbol 15 | @to_symbol = to_symbol 16 | end 17 | 18 | def exchange_rates 19 | Client.get(params: { 20 | function: FUNCTIONS[__method__], 21 | from_currency: @from_symbol, 22 | to_currency: @to_symbol 23 | }).realtime_currency_exchange_rate 24 | end 25 | 26 | def intraday(interval: '5min', outputsize: 'compact') 27 | Client.get(params: { 28 | function: FUNCTIONS[__method__], 29 | from_symbol: @from_symbol, 30 | to_symbol: @to_symbol, 31 | interval: validate_interval(interval), 32 | outputsize: validate_outputsize(outputsize) 33 | }) 34 | end 35 | 36 | def daily(outputsize: 'compact') 37 | Client.get(params: { 38 | function: FUNCTIONS[__method__], 39 | from_symbol: @from_symbol, 40 | to_symbol: @to_symbol, 41 | outputsize: validate_outputsize(outputsize) 42 | }) 43 | end 44 | 45 | def weekly 46 | Client.get(params: { 47 | function: FUNCTIONS[__callee__], 48 | from_symbol: @from_symbol, 49 | to_symbol: @to_symbol 50 | }) 51 | end 52 | alias :monthly :weekly 53 | end 54 | end -------------------------------------------------------------------------------- /lib/alphavantage/fundamental.rb: -------------------------------------------------------------------------------- 1 | module Alphavantage 2 | class Fundamental 3 | FUNCTIONS = { 4 | overview: 'OVERVIEW', 5 | earnings: 'EARNINGS', 6 | income_statement: 'INCOME_STATEMENT', 7 | balance_sheet: 'BALANCE_SHEET', 8 | cash_flow: 'CASH_FLOW' 9 | } 10 | 11 | def initialize(symbol:) 12 | @symbol = symbol 13 | end 14 | 15 | def overview 16 | response(FUNCTIONS[__method__]) 17 | end 18 | 19 | def earnings 20 | response(FUNCTIONS[__method__]).annual_earnings 21 | end 22 | 23 | def income_statement 24 | response(FUNCTIONS[__method__]).annual_reports 25 | end 26 | 27 | def balance_sheet 28 | response(FUNCTIONS[__method__]).annual_reports 29 | end 30 | 31 | def cash_flow 32 | response(FUNCTIONS[__method__]).annual_reports 33 | end 34 | 35 | private 36 | 37 | def response(function) 38 | Client.get(params: { function: function, symbol: @symbol }) 39 | end 40 | end 41 | end -------------------------------------------------------------------------------- /lib/alphavantage/indicator.rb: -------------------------------------------------------------------------------- 1 | module Alphavantage 2 | class Indicator 3 | include Validations 4 | 5 | def initialize(symbol:,interval:) 6 | @symbol = symbol 7 | @interval = interval 8 | end 9 | 10 | def sma(time_period:,series_type:) 11 | Client.get(params: { 12 | function: __callee__.upcase, 13 | symbol: @symbol, 14 | interval: validate_indicator_interval(@interval), 15 | time_period: validate_integer(label: 'time period', value: time_period), 16 | series_type: validate_series_type(series_type) 17 | }) 18 | end 19 | alias :ema :sma 20 | alias :wma :sma 21 | alias :dema :sma 22 | alias :tema :sma 23 | alias :trima :sma 24 | alias :kama :sma 25 | alias :mama :sma 26 | alias :t3 :sma 27 | alias :rsi :sma 28 | alias :mom :sma 29 | alias :cmo :sma 30 | alias :roc :sma 31 | alias :rocr :sma 32 | alias :trix :sma 33 | alias :midpoint :sma 34 | 35 | def macd(series_type:, fastperiod: 12, slowperiod: 26, signalperiod: 9) 36 | Client.get(params: { 37 | function: __callee__.upcase, 38 | symbol: @symbol, 39 | interval: validate_indicator_interval(@interval), 40 | series_type: validate_series_type(series_type), 41 | fastperiod: validate_integer(label: 'fastperiod', value: fastperiod), 42 | slowperiod: validate_integer(label: 'slowperiod', value: slowperiod), 43 | signalperiod: validate_integer(label: 'signalperiod', value: signalperiod) 44 | }) 45 | end 46 | 47 | MOVING_AVERAGE_TYPES = { 48 | sma: 0, 49 | ema: 1, 50 | wma: 2, 51 | dema: 3, 52 | tema: 4, 53 | trima: 5, 54 | t3: 6, 55 | kama: 7, 56 | mama: 8 57 | } 58 | 59 | def macdext( 60 | series_type:, 61 | fastperiod: 12, 62 | slowperiod: 26, 63 | signalperiod: 9, 64 | fastmatype: 'sma', 65 | slowmatype: 'sma', 66 | signalmatype: 'sma' 67 | ) 68 | Client.get(params: { 69 | function: __callee__.upcase, 70 | symbol: @symbol, 71 | interval: validate_indicator_interval(@interval), 72 | series_type: validate_series_type(series_type), 73 | fastperiod: validate_integer(label: 'fastperiod', value: fastperiod), 74 | slowperiod: validate_integer(label: 'slowperiod', value: slowperiod), 75 | signalperiod: validate_integer(label: 'signalperiod', value: signalperiod), 76 | fastmatype: validate_mat(MOVING_AVERAGE_TYPES[fastmatype.to_sym]), 77 | slowmatype: validate_mat(MOVING_AVERAGE_TYPES[slowmatype.to_sym]), 78 | signalmatype: validate_mat(MOVING_AVERAGE_TYPES[signalmatype.to_sym]) 79 | }) 80 | end 81 | 82 | def stoch( 83 | fastkperiod: 5, 84 | slowkperiod: 3, 85 | slowdperiod: 3, 86 | slowkmatype: 'sma', 87 | slowdmatype: 'sma' 88 | ) 89 | Client.get(params: { 90 | function: __callee__.upcase, 91 | symbol: @symbol, 92 | interval: validate_indicator_interval(@interval), 93 | fastkperiod: validate_integer(label: 'fastkperiod', value: fastkperiod), 94 | slowkperiod: validate_integer(label: 'slowkperiod', value: slowkperiod), 95 | slowdperiod: validate_integer(label: 'slowdperiod', value: slowdperiod), 96 | slowkmatype: validate_mat(MOVING_AVERAGE_TYPES[slowkmatype.to_sym]), 97 | slowdmatype: validate_mat(MOVING_AVERAGE_TYPES[slowdmatype.to_sym]) 98 | }) 99 | end 100 | 101 | def stochf( 102 | fastkperiod: 5, 103 | fastdperiod: 3, 104 | fastdmatype: 'sma' 105 | ) 106 | Client.get(params: { 107 | function: __callee__.upcase, 108 | symbol: @symbol, 109 | interval: validate_indicator_interval(@interval), 110 | fastkperiod: validate_integer(label: 'fastkperiod', value: fastkperiod), 111 | fastdperiod: validate_integer(label: 'fastdperiod', value: fastdperiod), 112 | fastdmatype: validate_mat(MOVING_AVERAGE_TYPES[fastdmatype.to_sym]) 113 | }) 114 | end 115 | 116 | def stochrsi( 117 | time_period:, 118 | series_type:, 119 | fastkperiod: 5, 120 | fastdperiod: 3, 121 | fastdmatype: 'sma' 122 | ) 123 | Client.get(params: { 124 | function: __callee__.upcase, 125 | symbol: @symbol, 126 | interval: validate_indicator_interval(@interval), 127 | time_period: validate_integer(label: 'time period', value: time_period), 128 | series_type: validate_series_type(series_type), 129 | fastkperiod: validate_integer(label: 'fastkperiod', value: fastkperiod), 130 | fastdperiod: validate_integer(label: 'fastdperiod', value: fastdperiod), 131 | fastdmatype: validate_mat(MOVING_AVERAGE_TYPES[fastdmatype.to_sym]) 132 | }) 133 | end 134 | 135 | def willr(time_period:) 136 | Client.get(params: { 137 | function: __callee__.upcase, 138 | symbol: @symbol, 139 | interval: validate_indicator_interval(@interval), 140 | time_period: validate_integer(label: 'time period', value: time_period) 141 | }) 142 | end 143 | alias :adx :willr 144 | alias :adxr :willr 145 | alias :aroon :willr 146 | alias :aroonosc :willr 147 | alias :mfi :willr 148 | alias :dx :willr 149 | alias :minus_di :willr 150 | alias :plus_di :willr 151 | alias :minus_dm :willr 152 | alias :plus_dm :willr 153 | alias :midprice :willr 154 | alias :atr :willr 155 | alias :natr :willr 156 | 157 | def vwap 158 | Client.get(params: { 159 | function: __callee__.upcase, 160 | symbol: @symbol, 161 | interval: [:bop,:trange,:ad,:obv].include?(__callee__) ? validate_indicator_interval(@interval) : validate_interval(@interval) 162 | }) 163 | end 164 | alias :bop :vwap 165 | alias :trange :vwap 166 | alias :ad :vwap 167 | alias :obv :vwap 168 | 169 | def adosc(fastperiod: 3, slowperiod: 10) 170 | Client.get(params: { 171 | function: __callee__.upcase, 172 | symbol: @symbol, 173 | interval: validate_indicator_interval(@interval), 174 | fastperiod: validate_integer(label: 'fastperiod', value: fastperiod), 175 | slowperiod: validate_integer(label: 'slowperiod', value: slowperiod) 176 | }) 177 | end 178 | 179 | def ht_trendline(series_type:) 180 | Client.get(params: { 181 | function: __callee__.upcase, 182 | symbol: @symbol, 183 | interval: validate_indicator_interval(@interval), 184 | series_type: validate_series_type(series_type) 185 | }) 186 | end 187 | alias :ht_sine :ht_trendline 188 | alias :ht_trendmode :ht_trendline 189 | alias :ht_dcperiod :ht_trendline 190 | alias :ht_dcphase :ht_trendline 191 | alias :ht_phasor :ht_trendline 192 | 193 | def apo(series_type:, fastperiod: 12, slowperiod: 26, matype: 'sma') 194 | Client.get(params: { 195 | function: __callee__.upcase, 196 | symbol: @symbol, 197 | interval: validate_indicator_interval(@interval), 198 | series_type: validate_series_type(series_type), 199 | fastperiod: validate_integer(label: 'fastperiod', value: fastperiod), 200 | slowperiod: validate_integer(label: 'slowperiod', value: slowperiod), 201 | matype: validate_mat(MOVING_AVERAGE_TYPES[matype.to_sym]) 202 | }) 203 | end 204 | alias :ppo :apo 205 | 206 | def bbands(time_period:, series_type:, nbdevup: 2, nbdevdn: 2, matype: 'sma') 207 | Client.get(params: { 208 | function: __callee__.upcase, 209 | symbol: @symbol, 210 | interval: validate_indicator_interval(@interval), 211 | time_period: validate_integer(label: 'time period', value: time_period), 212 | series_type: validate_series_type(series_type), 213 | nbdevup: validate_integer(label: 'nbdevup', value: nbdevup), 214 | nbdevdn: validate_integer(label: 'nbdevdn', value: nbdevdn), 215 | matype: validate_mat(MOVING_AVERAGE_TYPES[matype.to_sym]) 216 | }) 217 | end 218 | 219 | def sar(acceleration: 0.01, maximum: 0.20) 220 | Client.get(params: { 221 | function: __callee__.upcase, 222 | symbol: @symbol, 223 | interval: validate_indicator_interval(@interval), 224 | acceleration: validate_integer(label: 'acceleration', value: acceleration), 225 | maximum: validate_integer(label: 'maximum', value: maximum) 226 | }) 227 | end 228 | 229 | def ultosc(timeperiod1: 7, timeperiod2: 14, timeperiod3: 28) 230 | Client.get(params: { 231 | function: __callee__.upcase, 232 | symbol: @symbol, 233 | interval: validate_indicator_interval(@interval), 234 | timeperiod1: validate_integer(label: 'timeperiod1', value: timeperiod1), 235 | timeperiod2: validate_integer(label: 'timeperiod2', value: timeperiod2), 236 | timeperiod3: validate_integer(label: 'timeperiod3', value: timeperiod3) 237 | }) 238 | end 239 | 240 | end 241 | end -------------------------------------------------------------------------------- /lib/alphavantage/normalize_key.rb: -------------------------------------------------------------------------------- 1 | module Alphavantage 2 | class NormalizeKey 3 | def initialize(key:) 4 | @key = key 5 | end 6 | 7 | def call 8 | return @key if is_date?(@key) 9 | underscore_key(sanitize_key(@key)) 10 | end 11 | 12 | private 13 | 14 | def underscore_key(key) 15 | key.to_s.gsub(/::/, '/'). 16 | gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). 17 | gsub(/([a-z\d])([A-Z])/,'\1_\2'). 18 | tr("-", "_"). 19 | downcase.to_sym 20 | end 21 | 22 | def sanitize_key(key) 23 | key.tr('.():/','').gsub(/^\d+.?\s/, "").tr(' ','_') 24 | end 25 | 26 | def is_date?(key) 27 | !/(\d{4}-\d{2}-\d{2})/.match(key.to_s).nil? 28 | end 29 | end 30 | end -------------------------------------------------------------------------------- /lib/alphavantage/time_series.rb: -------------------------------------------------------------------------------- 1 | module Alphavantage 2 | class TimeSeries 3 | include Validations 4 | 5 | FUNCTIONS = { 6 | search: 'SYMBOL_SEARCH', 7 | quote: 'GLOBAL_QUOTE', 8 | monthly: 'TIME_SERIES_MONTHLY', 9 | monthly_adjusted: 'TIME_SERIES_MONTHLY_ADJUSTED', 10 | weekly: 'TIME_SERIES_WEEKLY', 11 | weekly_adjusted: 'TIME_SERIES_WEEKLY_ADJUSTED', 12 | daily: 'TIME_SERIES_DAILY', 13 | daily_adjusted: 'TIME_SERIES_DAILY_ADJUSTED', 14 | intraday: 'TIME_SERIES_INTRADAY', 15 | intraday_extended_history: 'TIME_SERIES_INTRADAY_EXTENDED' 16 | } 17 | 18 | def self.search(keywords:) 19 | Client.get(params: { function: self::FUNCTIONS[__method__], keywords: keywords }).best_matches 20 | end 21 | 22 | def initialize(symbol:) 23 | @symbol = symbol 24 | end 25 | 26 | def quote 27 | Client.get(params: { function: FUNCTIONS[__method__], symbol: @symbol }).global_quote 28 | end 29 | 30 | def monthly(adjusted: false) 31 | function = adjusted ? FUNCTIONS[:monthly_adjusted] : FUNCTIONS[__method__] 32 | Client.get(params: { function: function, symbol: @symbol }) 33 | end 34 | 35 | def weekly(adjusted: false) 36 | function = adjusted ? FUNCTIONS[:weekly_adjusted] : FUNCTIONS[__method__] 37 | Client.get(params: { function: function, symbol: @symbol }) 38 | end 39 | 40 | def daily(adjusted: false, outputsize: 'compact') 41 | function = adjusted ? FUNCTIONS[:daily_adjusted] : FUNCTIONS[__method__] 42 | Client.get(params: { function: function, symbol: @symbol, outputsize: validate_outputsize(outputsize) }) 43 | end 44 | 45 | def intraday(adjusted: true, outputsize: 'compact', interval: '5min', datatype: 'json') 46 | params = { 47 | function: FUNCTIONS[__method__], 48 | symbol: @symbol, 49 | outputsize: validate_outputsize(outputsize), 50 | interval: validate_interval(interval), 51 | datatype: datatype, 52 | adjusted: adjusted 53 | } 54 | 55 | Client.get(datatype: validate_datatype(datatype), params: params) 56 | end 57 | 58 | def intraday_extended_history(adjusted: true, outputsize: 'compact', interval: '5min', slice: 'year1month1') 59 | params = { 60 | function: FUNCTIONS[:intraday_extended_history], 61 | symbol: @symbol, 62 | slice: validate_slice(slice), 63 | interval: validate_interval(interval), 64 | adjusted: adjusted 65 | } 66 | 67 | Client.get(datatype: :csv, params: params) 68 | end 69 | 70 | end 71 | end -------------------------------------------------------------------------------- /lib/alphavantage/validations.rb: -------------------------------------------------------------------------------- 1 | module Alphavantage 2 | module Validations 3 | VALID_SLICES = (1..2).map do |year| 4 | (1..12).map do |month| 5 | "year#{year}month#{month}" 6 | end 7 | end.flatten.map(&:to_sym) 8 | 9 | VALID_INTERVALS = %i{ 1min 5min 15min 30min 60min } 10 | VALID_INDICATOR_INTERVALS = VALID_INTERVALS + %i{ daily weekly monthly } 11 | VALID_OUTPUTSIZES = %i{ compact full } 12 | VALID_SERIES_TYPES = %i{ close open high low } 13 | VALID_DATATYPES = %i{ json csv } 14 | 15 | private 16 | 17 | def validate_slice(value) 18 | validate_from_collection(value: value, collection: VALID_SLICES, type: 'slice') 19 | end 20 | 21 | def validate_interval(value) 22 | validate_from_collection(value: value, collection: VALID_INTERVALS, type: 'interval') 23 | end 24 | 25 | def validate_outputsize(value) 26 | validate_from_collection(value: value, collection: VALID_OUTPUTSIZES, type: 'outputsize') 27 | end 28 | 29 | def validate_indicator_interval(value) 30 | validate_from_collection(value: value, collection: VALID_INDICATOR_INTERVALS, type: 'interval') 31 | end 32 | 33 | def validate_series_type(value) 34 | validate_from_collection(value: value, collection: VALID_SERIES_TYPES, type: 'series type') 35 | end 36 | 37 | def validate_datatype(value) 38 | validate_from_collection(value: value, collection: VALID_DATATYPES, type: 'data type') 39 | end 40 | 41 | def validate_integer(label:,value:) 42 | raise Alphavantage::Error, "Invalid #{label} given. Must be integer." unless is_integer?(value) 43 | value 44 | end 45 | 46 | def validate_mat(moving_average_type) 47 | raise Alphavantage::Error, "Invalid moving average type given." if !(0..8).include?(moving_average_type) 48 | moving_average_type 49 | end 50 | 51 | def is_integer?(str) 52 | Integer(str) rescue false 53 | end 54 | 55 | private 56 | 57 | def validate_from_collection(value:, collection:, type:) 58 | return value if collection.include?(value.to_sym) 59 | 60 | message = "Invalid #{type} given. Given #{value}, allowed: #{collection.map{|c| "'#{c}'"}.join(', ')}" 61 | raise Alphavantage::Error, message 62 | end 63 | end 64 | end -------------------------------------------------------------------------------- /lib/alphavantage/version.rb: -------------------------------------------------------------------------------- 1 | module Alphavantage 2 | VERSION = "1.2.0" 3 | end 4 | -------------------------------------------------------------------------------- /spec/alphavantage/client_spec.rb: -------------------------------------------------------------------------------- 1 | 2 | describe Alphavantage::Client do 3 | 4 | describe '::get' do 5 | context 'error' do 6 | before do 7 | Alphavantage.configure do |config| 8 | config.api_key = '' 9 | end 10 | end 11 | 12 | let(:body) do 13 | "{\n \"Error Message\": \"the parameter apikey is invalid or missing. " \ 14 | "Please claim your free API key on (https://www.alphavantage.co/support/#api-key). " \ 15 | "It should take less than 20 seconds.\"\n}" 16 | end 17 | 18 | before do 19 | stub_request(:get, "https://www.alphavantage.co/query?apikey="). 20 | to_return(status: 200, body: body, headers: {}) 21 | end 22 | 23 | context 'json request' do 24 | subject { described_class.get(params: {}) } 25 | 26 | it 'should raise' do 27 | expect { subject }.to raise_error Alphavantage::Error 28 | end 29 | end 30 | 31 | context 'csv request' do 32 | subject { described_class.get(params: {}, datatype: :csv) } 33 | 34 | it 'should raise' do 35 | expect { subject }.to raise_error Alphavantage::Error 36 | end 37 | end 38 | end 39 | end 40 | end -------------------------------------------------------------------------------- /spec/alphavantage/configuration_spec.rb: -------------------------------------------------------------------------------- 1 | describe Alphavantage::Configuration do 2 | after(:each) do 3 | described_class.instance_variable_set('@configuration', nil) 4 | end 5 | 6 | it 'should set the configuration with a config block' do 7 | Alphavantage.configure do |config| 8 | config.api_key = 'someKey' 9 | end 10 | 11 | expect(Alphavantage.configuration.api_key).to eq('someKey') 12 | end 13 | 14 | # Why is this important? Because some API keys are rate limited. Having 15 | # a proc as an api_key allows the user to inject an API Key Manager 16 | # or rate limiter process. 17 | # 18 | it "should support a Proc as an api_key" do 19 | Alphavantage.configure do |config| 20 | config.api_key = -> { Time.now } 21 | end 22 | 23 | key1 = Alphavantage.configuration.api_key 24 | sleep(1) 25 | key2 = Alphavantage.configuration.api_key 26 | 27 | expect(key1.class).to eq(Time) 28 | expect(key2.class).to eq(Time) 29 | expect(key1 < Key2).to be(true) 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /spec/alphavantage/crypto_spec.rb: -------------------------------------------------------------------------------- 1 | describe Alphavantage::Crypto do 2 | before do 3 | Alphavantage.configure do |config| 4 | config.api_key = 'demo' 5 | end 6 | end 7 | 8 | describe '.health_index' do 9 | subject { described_class.health_index(symbol: 'BTC') } 10 | 11 | before do 12 | stub_request(:get, "https://www.alphavantage.co/query?function=CRYPTO_RATING&symbol=BTC&apikey=demo"). 13 | to_return(status: 200, body: file_fixture("crypto/health_index.json"), headers: {}) 14 | end 15 | 16 | it 'returns health index data' do 17 | expect(subject.fcas_rating).to eq('Attractive') 18 | end 19 | end 20 | 21 | describe '#intraday' do 22 | subject { described_class.new(symbol: 'ETH', market: 'USD').intraday(interval: '5min') } 23 | 24 | before do 25 | stub_request(:get, "https://www.alphavantage.co/query?function=CRYPTO_INTRADAY&symbol=ETH&market=USD&interval=5min&apikey=demo"). 26 | to_return(status: 200, body: file_fixture("crypto/intraday.json"), headers: {}) 27 | end 28 | 29 | it 'returns meta data' do 30 | expect(subject.meta_data).to have_attributes({ 31 | information: "Crypto Intraday (5min) Time Series" 32 | }) 33 | end 34 | 35 | it 'returns time series' do 36 | expect(subject.time_series_crypto_5min["2021-04-25 15:45:00"]).to have_attributes({ 37 | close: "2340.22000", 38 | high: "2342.00000", 39 | low: "2334.42000", 40 | volume: 1367 41 | }) 42 | expect(subject.time_series_crypto_5min["2021-04-25 15:45:00"].open).to eq("2339.76000") 43 | end 44 | 45 | context 'when invalid interval given' do 46 | subject { described_class.new(symbol: 'ETH', market: 'USD').intraday(interval: '100min') } 47 | it 'should raise error' do 48 | expect { subject }.to raise_error(Alphavantage::Error, /Invalid interval given./) 49 | end 50 | end 51 | end 52 | 53 | describe '#daily' do 54 | subject { described_class.new(symbol: 'BTC', market: 'CNY').daily } 55 | before do 56 | stub_request(:get, "https://www.alphavantage.co/query?function=DIGITAL_CURRENCY_DAILY&symbol=BTC&market=CNY&apikey=demo"). 57 | to_return(status: 200, body: file_fixture("crypto/daily.json"), headers: {}) 58 | end 59 | it 'returns meta data' do 60 | expect(subject.meta_data).to have_attributes({ 61 | information: "Daily Prices and Volumes for Digital Currency" 62 | }) 63 | end 64 | it 'returns time series' do 65 | expect(subject.time_series_digital_currency_daily["2021-04-25"]).to have_attributes({ 66 | open_cny: "325140.79734400" 67 | }) 68 | end 69 | end 70 | 71 | describe '#weekly' do 72 | subject { described_class.new(symbol: 'BTC', market: 'CNY').weekly } 73 | before do 74 | stub_request(:get, "https://www.alphavantage.co/query?function=DIGITAL_CURRENCY_WEEKLY&symbol=BTC&market=CNY&apikey=demo"). 75 | to_return(status: 200, body: file_fixture("crypto/weekly.json"), headers: {}) 76 | end 77 | it 'returns meta data' do 78 | expect(subject.meta_data).to have_attributes({ 79 | information: "Weekly Prices and Volumes for Digital Currency" 80 | }) 81 | end 82 | it 'returns time series' do 83 | expect(subject.time_series_digital_currency_weekly["2021-04-25"]).to have_attributes({ 84 | open_cny: "364784.15496600" 85 | }) 86 | end 87 | end 88 | 89 | describe '#monthly' do 90 | subject { described_class.new(symbol: 'BTC', market: 'CNY').monthly } 91 | before do 92 | stub_request(:get, "https://www.alphavantage.co/query?function=DIGITAL_CURRENCY_MONTHLY&symbol=BTC&market=CNY&apikey=demo"). 93 | to_return(status: 200, body: file_fixture("crypto/monthly.json"), headers: {}) 94 | end 95 | it 'returns meta data' do 96 | expect(subject.meta_data).to have_attributes({ 97 | information: "Monthly Prices and Volumes for Digital Currency" 98 | }) 99 | end 100 | it 'returns time series' do 101 | expect(subject.time_series_digital_currency_monthly["2021-04-25"]).to have_attributes({ 102 | open_cny: "381606.77583600" 103 | }) 104 | end 105 | end 106 | end -------------------------------------------------------------------------------- /spec/alphavantage/forex_spec.rb: -------------------------------------------------------------------------------- 1 | describe Alphavantage::Forex do 2 | before do 3 | Alphavantage.configure do |config| 4 | config.api_key = 'demo' 5 | end 6 | end 7 | 8 | describe '#exchange_rates' do 9 | subject { described_class.new(from_symbol: 'USD', to_symbol: 'JPY').exchange_rates } 10 | 11 | before do 12 | stub_request(:get, "https://www.alphavantage.co/query?apikey=demo&from_currency=USD&function=CURRENCY_EXCHANGE_RATE&to_currency=JPY"). 13 | to_return(status: 200, body: file_fixture("forex/exchange_rates.json"), headers: {}) 14 | end 15 | 16 | it 'returns exchange rates' do 17 | expect(subject.exchange_rate).to eq('107.86500000') 18 | end 19 | end 20 | 21 | describe '#intraday' do 22 | subject { described_class.new(from_symbol: 'EUR', to_symbol: 'USD').intraday } 23 | 24 | before do 25 | stub_request(:get, "https://www.alphavantage.co/query?apikey=demo&from_symbol=EUR&function=FX_INTRADAY&interval=5min&outputsize=compact&to_symbol=USD"). 26 | to_return(status: 200, body: file_fixture("forex/intraday.json"), headers: {}) 27 | end 28 | 29 | it 'returns meta data' do 30 | expect(subject.meta_data).to have_attributes({ 31 | information: "FX Intraday (5min) Time Series", 32 | from_symbol: "EUR", 33 | to_symbol: "USD", 34 | last_refreshed: "2021-04-23 21:55:00", 35 | interval: "5min", 36 | output_size: "Compact", 37 | time_zone: "UTC" 38 | }) 39 | end 40 | 41 | it 'returns time series' do 42 | expect(subject.time_series_fx_5min['2021-04-23 21:55:00'].close).to eq('1.20965') 43 | end 44 | end 45 | 46 | describe '#daily' do 47 | subject { described_class.new(from_symbol: 'EUR', to_symbol: 'USD').daily } 48 | 49 | before do 50 | stub_request(:get, "https://www.alphavantage.co/query?apikey=demo&from_symbol=EUR&function=FX_DAILY&outputsize=compact&to_symbol=USD"). 51 | to_return(status: 200, body: file_fixture("forex/daily.json"), headers: {}) 52 | end 53 | 54 | it 'returns meta data' do 55 | expect(subject.meta_data).to have_attributes({ 56 | information: "Forex Daily Prices (open, high, low, close)", 57 | from_symbol: "EUR", 58 | to_symbol: "USD", 59 | last_refreshed: "2021-04-23 21:55:00", 60 | output_size: "Compact", 61 | time_zone: "UTC" 62 | }) 63 | end 64 | 65 | it 'returns time series' do 66 | expect(subject.time_series_fx_daily['2021-04-23'].close).to eq('1.20965') 67 | end 68 | end 69 | 70 | describe '#weekly' do 71 | subject { described_class.new(from_symbol: 'EUR', to_symbol: 'USD').weekly } 72 | 73 | before do 74 | stub_request(:get, "https://www.alphavantage.co/query?apikey=demo&from_symbol=EUR&function=FX_WEEKLY&to_symbol=USD"). 75 | to_return(status: 200, body: file_fixture("forex/weekly.json"), headers: {}) 76 | end 77 | 78 | it 'returns meta data' do 79 | expect(subject.meta_data).to have_attributes({ 80 | information: "Forex Weekly Prices (open, high, low, close)", 81 | from_symbol: "EUR", 82 | to_symbol: "USD", 83 | last_refreshed: "2021-04-23 21:55:00", 84 | time_zone: "UTC" 85 | }) 86 | end 87 | 88 | it 'returns time series' do 89 | expect(subject.time_series_fx_weekly['2021-04-23'].close).to eq('1.20965') 90 | end 91 | end 92 | 93 | describe '#monthly' do 94 | subject { described_class.new(from_symbol: 'EUR', to_symbol: 'USD').monthly } 95 | 96 | before do 97 | stub_request(:get, "https://www.alphavantage.co/query?apikey=demo&from_symbol=EUR&function=FX_MONTHLY&to_symbol=USD"). 98 | to_return(status: 200, body: file_fixture("forex/monthly.json"), headers: {}) 99 | end 100 | 101 | it 'returns meta data' do 102 | expect(subject.meta_data).to have_attributes({ 103 | information: "Forex Monthly Prices (open, high, low, close)", 104 | from_symbol: "EUR", 105 | to_symbol: "USD", 106 | last_refreshed: "2021-04-23 21:55:00", 107 | time_zone: "UTC" 108 | }) 109 | end 110 | 111 | it 'returns time series' do 112 | expect(subject.time_series_fx_monthly['2021-04-23'].close).to eq('1.20965') 113 | end 114 | end 115 | end -------------------------------------------------------------------------------- /spec/alphavantage/fundamental_spec.rb: -------------------------------------------------------------------------------- 1 | describe Alphavantage::Fundamental do 2 | before do 3 | Alphavantage.configure do |config| 4 | config.api_key = 'someKey' 5 | end 6 | end 7 | 8 | describe '#overview' do 9 | subject { described_class.new(symbol: 'TSLA').overview } 10 | 11 | before do 12 | stub_request(:get, "https://www.alphavantage.co/query?apikey=someKey&function=OVERVIEW&symbol=TSLA"). 13 | to_return(status: 200, body: file_fixture("fundamental/company_overview.json"), headers: {}) 14 | end 15 | 16 | it 'returns company overview' do 17 | expect(subject.industry).to eq('Auto Manufacturers') 18 | end 19 | end 20 | 21 | describe '#earnings' do 22 | subject { described_class.new(symbol: 'TSLA').earnings } 23 | 24 | before do 25 | stub_request(:get, "https://www.alphavantage.co/query?apikey=someKey&function=EARNINGS&symbol=TSLA"). 26 | to_return(status: 200, body: file_fixture("fundamental/earnings.json"), headers: {}) 27 | end 28 | 29 | it 'returns company earnings' do 30 | expect(subject.first).to have_attributes({fiscal_date_ending: '2021-03-31', reported_eps: '0'}) 31 | end 32 | end 33 | 34 | describe '#income_statement' do 35 | subject { described_class.new(symbol: 'TSLA').income_statement } 36 | 37 | before do 38 | stub_request(:get, "https://www.alphavantage.co/query?apikey=someKey&function=INCOME_STATEMENT&symbol=TSLA"). 39 | to_return(status: 200, body: file_fixture("fundamental/income_statement.json"), headers: {}) 40 | end 41 | 42 | it 'returns company income statements' do 43 | expect(subject.first).to have_attributes({gross_profit: '6630000000'}) 44 | end 45 | end 46 | 47 | describe '#balance_sheet' do 48 | subject { described_class.new(symbol: 'TSLA').balance_sheet } 49 | 50 | before do 51 | stub_request(:get, "https://www.alphavantage.co/query?apikey=someKey&function=BALANCE_SHEET&symbol=TSLA"). 52 | to_return(status: 200, body: file_fixture("fundamental/balance_sheet.json"), headers: {}) 53 | end 54 | 55 | it 'returns company income statements' do 56 | expect(subject.first).to have_attributes({total_assets: '52148000000'}) 57 | end 58 | end 59 | 60 | describe '#cash_flow' do 61 | subject { described_class.new(symbol: 'TSLA').cash_flow } 62 | 63 | before do 64 | stub_request(:get, "https://www.alphavantage.co/query?apikey=someKey&function=CASH_FLOW&symbol=TSLA"). 65 | to_return(status: 200, body: file_fixture("fundamental/cash_flow.json"), headers: {}) 66 | end 67 | 68 | it 'returns company income statements' do 69 | expect(subject.first).to have_attributes({operating_cashflow: '5943000000'}) 70 | end 71 | end 72 | end -------------------------------------------------------------------------------- /spec/alphavantage/indicator_spec.rb: -------------------------------------------------------------------------------- 1 | describe Alphavantage::Indicator do 2 | before do 3 | Alphavantage.configure do |config| 4 | config.api_key = 'demo' 5 | end 6 | end 7 | 8 | describe '#sma' do 9 | let(:interval) { 'weekly' } 10 | let(:time_period) { 10 } 11 | let(:series_type) { 'open' } 12 | 13 | subject { described_class.new(symbol: 'TSLA', interval: interval).sma(time_period: time_period, series_type: series_type) } 14 | 15 | before do 16 | stub_request(:get, "https://www.alphavantage.co/query?function=SMA&symbol=TSLA&interval=weekly&time_period=10&series_type=open&apikey=demo"). 17 | to_return(status: 200, body: file_fixture("indicator/sma.json"), headers: {}) 18 | end 19 | 20 | it 'returns meta data' do 21 | expect(subject.meta_data).to have_attributes({ 22 | indicator: "Simple Moving Average (SMA)" 23 | }) 24 | end 25 | 26 | it 'returns sma' do 27 | expect(subject.technical_analysis_sma["2021-04-23"]).to have_attributes({ 28 | sma: "697.8630" 29 | }) 30 | end 31 | 32 | context 'when invalid interval given' do 33 | let(:interval) { 'century' } 34 | it 'should raise error' do 35 | expect { subject }.to raise_error(Alphavantage::Error, /Invalid interval given./) 36 | end 37 | end 38 | 39 | context 'when invalid time period given' do 40 | let(:time_period) { 'string' } 41 | it 'should raise error' do 42 | expect { subject }.to raise_error(Alphavantage::Error, "Invalid time period given. Must be integer.") 43 | end 44 | end 45 | 46 | context 'when invalid series type given' do 47 | let(:series_type) { 'banana' } 48 | it 'should raise error' do 49 | expect { subject }.to raise_error(Alphavantage::Error, /Invalid series type given./) 50 | end 51 | end 52 | end 53 | 54 | describe '#ema' do 55 | let(:interval) { 'weekly' } 56 | let(:time_period) { 10 } 57 | let(:series_type) { 'open' } 58 | 59 | subject { described_class.new(symbol: 'TSLA', interval: interval).ema(time_period: time_period, series_type: series_type) } 60 | 61 | before do 62 | stub_request(:get, "https://www.alphavantage.co/query?function=EMA&symbol=TSLA&interval=weekly&time_period=10&series_type=open&apikey=demo"). 63 | to_return(status: 200, body: file_fixture("indicator/ema.json"), headers: {}) 64 | end 65 | 66 | it 'returns meta data' do 67 | expect(subject.meta_data).to have_attributes({ 68 | indicator: "Exponential Moving Average (EMA)" 69 | }) 70 | end 71 | 72 | it 'returns ema' do 73 | expect(subject.technical_analysis_ema["2021-04-23"]).to have_attributes({ 74 | ema: "699.3560" 75 | }) 76 | end 77 | 78 | context 'when invalid interval given' do 79 | let(:interval) { 'century' } 80 | it 'should raise error' do 81 | expect { subject }.to raise_error(Alphavantage::Error, /Invalid interval given./) 82 | end 83 | end 84 | 85 | context 'when invalid time period given' do 86 | let(:time_period) { 'string' } 87 | it 'should raise error' do 88 | expect { subject }.to raise_error(Alphavantage::Error, "Invalid time period given. Must be integer.") 89 | end 90 | end 91 | 92 | context 'when invalid series type given' do 93 | let(:series_type) { 'banana' } 94 | it 'should raise error' do 95 | expect { subject }.to raise_error(Alphavantage::Error, /Invalid series type given./) 96 | end 97 | end 98 | end 99 | 100 | describe '#vwap' do 101 | let(:interval) { '5min' } 102 | subject { described_class.new(symbol: 'IBM', interval: interval).vwap } 103 | 104 | before do 105 | stub_request(:get, "https://www.alphavantage.co/query?function=VWAP&symbol=IBM&interval=#{interval}&apikey=demo"). 106 | to_return(status: 200, body: file_fixture("indicator/vwap.json"), headers: {}) 107 | end 108 | 109 | it 'returns meta data' do 110 | expect(subject.meta_data).to have_attributes({ 111 | indicator: "Volume Weighted Average Price (VWAP)" 112 | }) 113 | end 114 | 115 | it 'returns vwap' do 116 | expect(subject.technical_analysis_vwap["2021-04-30 20:00"]).to have_attributes({ 117 | vwap: "141.5264" 118 | }) 119 | end 120 | end 121 | 122 | describe '#bop' do 123 | let(:interval) { 'weekly' } 124 | subject { described_class.new(symbol: 'IBM', interval: interval).bop } 125 | 126 | before do 127 | stub_request(:get, "https://www.alphavantage.co/query?function=BOP&symbol=IBM&interval=#{interval}&apikey=demo"). 128 | to_return(status: 200, body: file_fixture("indicator/bop.json"), headers: {}) 129 | end 130 | 131 | it 'returns meta data' do 132 | expect(subject.meta_data).to have_attributes({ 133 | indicator: "Balance Of Power (BOP)" 134 | }) 135 | end 136 | 137 | it 'returns bop' do 138 | expect(subject.technical_analysis_bop["2021-04-30"]).to have_attributes({ 139 | bop: "-0.5549" 140 | }) 141 | end 142 | end 143 | 144 | describe '#macd' do 145 | let(:interval) { 'weekly' } 146 | let(:series_type) { 'open' } 147 | let(:fastperiod) { '12' } 148 | let(:slowperiod) { '26' } 149 | let(:signalperiod) { '9' } 150 | 151 | subject { described_class.new(symbol: 'IBM', interval: interval).macd(series_type: series_type, fastperiod: fastperiod, slowperiod: slowperiod, signalperiod: signalperiod) } 152 | 153 | before do 154 | stub_request(:get, "https://www.alphavantage.co/query?function=MACD&symbol=IBM&interval=#{interval}&series_type=#{series_type}&fastperiod=#{fastperiod}&slowperiod=#{slowperiod}&signalperiod=#{signalperiod}&apikey=demo"). 155 | to_return(status: 200, body: file_fixture("indicator/macd.json"), headers: {}) 156 | end 157 | 158 | it 'returns meta data' do 159 | expect(subject.meta_data).to have_attributes({ 160 | indicator: "Moving Average Convergence/Divergence (MACD)" 161 | }) 162 | end 163 | 164 | it 'returns macd' do 165 | expect(subject.technical_analysis_macd["2021-04-30"]).to have_attributes({ 166 | macd: "3.5648" 167 | }) 168 | end 169 | end 170 | 171 | describe '#stoch' do 172 | let(:interval) { 'weekly' } 173 | let(:fastkperiod) { '5' } 174 | let(:slowkperiod) { '3' } 175 | let(:slowdperiod) { '3' } 176 | let(:slowkmatype) { 'ema' } 177 | let(:slowdmatype) { 'kama' } 178 | 179 | subject do 180 | described_class.new(symbol: 'IBM', interval: interval). 181 | stoch( 182 | fastkperiod: fastkperiod, 183 | slowkperiod: slowkperiod, 184 | slowdperiod: slowdperiod, 185 | slowkmatype: slowkmatype, 186 | slowdmatype: slowdmatype 187 | ) 188 | end 189 | 190 | before do 191 | stub_request(:get, "https://www.alphavantage.co/query?apikey=demo&fastkperiod=5&function=STOCH&interval=weekly&slowdmatype=7&slowdperiod=3&slowkmatype=1&slowkperiod=3&symbol=IBM"). 192 | to_return(status: 200, body: file_fixture("indicator/stoch.json"), headers: {}) 193 | end 194 | 195 | it 'returns meta data' do 196 | expect(subject.meta_data).to have_attributes({ 197 | indicator: "Stochastic (STOCH)" 198 | }) 199 | end 200 | 201 | it 'returns stoch' do 202 | expect(subject.technical_analysis_stoch["2021-04-30"]).to have_attributes({ 203 | slow_k: "38.7700", 204 | slow_d: "50.6307" 205 | }) 206 | end 207 | end 208 | 209 | end -------------------------------------------------------------------------------- /spec/alphavantage/normalize_key_spec.rb: -------------------------------------------------------------------------------- 1 | describe Alphavantage::NormalizeKey do 2 | describe '#call' do 3 | 4 | let(:key_a) { "Crypto Rating (FCAS)" } 5 | let(:key_b) { "3. fcas rating" } 6 | let(:key_c) { "4. Last Refreshed" } 7 | let(:key_d) { "Time Series FX (5min)" } 8 | let(:key_e) { "1a. open (CNY)" } 9 | let(:key_f) { "Technical Analysis: SMA" } 10 | let(:key_g) { "Technical Analysis: Chaikin A/D" } 11 | 12 | it 'returns normalized key' do 13 | expect(described_class.new(key: key_a).call).to eq(:crypto_rating_fcas) 14 | expect(described_class.new(key: key_b).call).to eq(:fcas_rating) 15 | expect(described_class.new(key: key_c).call).to eq(:last_refreshed) 16 | expect(described_class.new(key: key_d).call).to eq(:time_series_fx_5min) 17 | expect(described_class.new(key: key_e).call).to eq(:open_cny) 18 | expect(described_class.new(key: key_f).call).to eq(:technical_analysis_sma) 19 | expect(described_class.new(key: key_g).call).to eq(:technical_analysis_chaikin_ad) 20 | end 21 | 22 | context 'when key is date' do 23 | let(:key_date) { "2021-04-23" } 24 | it 'returns the same' do 25 | expect(described_class.new(key: key_date).call).to eq("2021-04-23") 26 | end 27 | end 28 | 29 | context 'when key is date' do 30 | let(:key_date_time) { "2021-04-23 21:55:00" } 31 | it 'returns the same' do 32 | expect(described_class.new(key: key_date_time).call).to eq("2021-04-23 21:55:00") 33 | end 34 | end 35 | 36 | end 37 | end -------------------------------------------------------------------------------- /spec/alphavantage/time_series_spec.rb: -------------------------------------------------------------------------------- 1 | 2 | describe Alphavantage::TimeSeries do 3 | before do 4 | Alphavantage.configure do |config| 5 | config.api_key = 'someKey' 6 | end 7 | end 8 | 9 | describe '.search' do 10 | subject { described_class.search(keywords: 'Tesla') } 11 | 12 | before do 13 | stub_request(:get, "https://www.alphavantage.co/query?apikey=someKey&function=SYMBOL_SEARCH&keywords=Tesla"). 14 | to_return(status: 200, body: file_fixture("time_series/search.json"), headers: {}) 15 | end 16 | 17 | it 'returns search result' do 18 | expect(subject.map(&:symbol)).to match_array(%w{ TL0.DEX TL0.FRK TSLA34.SAO TSLA TXLZF }) 19 | end 20 | end 21 | 22 | describe '#quote' do 23 | subject { described_class.new(symbol: 'TSLA').quote } 24 | 25 | before do 26 | stub_request(:get, "https://www.alphavantage.co/query?apikey=someKey&function=GLOBAL_QUOTE&symbol=TSLA"). 27 | to_return(status: 200, body: file_fixture("time_series/quote.json"), headers: {}) 28 | end 29 | 30 | it 'returns quote result' do 31 | expect(subject).to have_attributes({ 32 | change: "9.7100", 33 | symbol: "TSLA", 34 | change_percent: "1.3492%", 35 | high: "737.3600", 36 | latest_trading_day: "2021-04-23", 37 | low: "715.4600", 38 | previous_close: "719.6900", 39 | price: "729.4000", 40 | volume: "27879033" 41 | }) 42 | 43 | # For some reason have_attributes is calling the `open` method on subject raising ArgumentError 44 | expect(subject.open).to eq("719.8000") 45 | end 46 | end 47 | 48 | describe '#monthly' do 49 | subject { described_class.new(symbol: 'TSLA').monthly } 50 | before do 51 | stub_request(:get, "https://www.alphavantage.co/query?apikey=someKey&function=TIME_SERIES_MONTHLY&symbol=TSLA"). 52 | to_return(status: 200, body: file_fixture("time_series/monthly.json"), headers: {}) 53 | end 54 | 55 | it 'returns meta data' do 56 | expect(subject.meta_data).to have_attributes({ 57 | information: "Monthly Prices (open, high, low, close) and Volumes", 58 | last_refreshed: "2021-04-23", 59 | symbol: "TSLA", 60 | time_zone: "US/Eastern" 61 | }) 62 | end 63 | 64 | it 'returns monthly time series' do 65 | expect(subject.monthly_time_series["2021-04-23"]).to have_attributes({ 66 | close: "729.4000", 67 | high: "780.7900", 68 | low: "659.4200", 69 | volume: "525522527" 70 | }) 71 | expect(subject.monthly_time_series["2021-04-23"].open).to eq("688.3700") 72 | end 73 | 74 | context 'when adjusted' do 75 | subject { described_class.new(symbol: 'TSLA').monthly(adjusted: true) } 76 | before do 77 | stub_request(:get, "https://www.alphavantage.co/query?apikey=someKey&function=TIME_SERIES_MONTHLY_ADJUSTED&symbol=TSLA"). 78 | to_return(status: 200, body: file_fixture("time_series/monthly_adjusted.json"), headers: {}) 79 | end 80 | 81 | it 'returns meta data' do 82 | expect(subject.meta_data).to have_attributes({ 83 | information: "Monthly Adjusted Prices and Volumes", 84 | last_refreshed: "2021-04-23", 85 | symbol: "TSLA", 86 | time_zone: "US/Eastern" 87 | }) 88 | end 89 | 90 | it 'returns monthly adjusted time series' do 91 | expect(subject.monthly_adjusted_time_series["2021-04-23"]).to have_attributes({ 92 | close: "729.4000", 93 | high: "780.7900", 94 | low: "659.4200", 95 | volume: "525522527", 96 | adjusted_close: "729.4000", 97 | dividend_amount: "0.0000" 98 | }) 99 | expect(subject.monthly_adjusted_time_series["2021-04-23"].open).to eq("688.3700") 100 | end 101 | end 102 | end 103 | 104 | describe '#weekly' do 105 | subject { described_class.new(symbol: 'TSLA').weekly } 106 | before do 107 | stub_request(:get, "https://www.alphavantage.co/query?apikey=someKey&function=TIME_SERIES_WEEKLY&symbol=TSLA"). 108 | to_return(status: 200, body: file_fixture("time_series/weekly.json"), headers: {}) 109 | end 110 | 111 | it 'returns meta data' do 112 | expect(subject.meta_data).to have_attributes({ 113 | information: "Weekly Prices (open, high, low, close) and Volumes", 114 | last_refreshed: "2021-04-23", 115 | symbol: "TSLA", 116 | time_zone: "US/Eastern" 117 | }) 118 | end 119 | 120 | it 'returns weekly time series' do 121 | expect(subject.weekly_time_series["2021-04-23"]).to have_attributes({ 122 | close: "729.4000", 123 | high: "753.7700", 124 | low: "691.8001", 125 | volume: "169804356" 126 | }) 127 | expect(subject.weekly_time_series["2021-04-23"].open).to eq("719.6000") 128 | end 129 | 130 | context 'when adjusted' do 131 | subject { described_class.new(symbol: 'TSLA').weekly(adjusted: true) } 132 | before do 133 | stub_request(:get, "https://www.alphavantage.co/query?apikey=someKey&function=TIME_SERIES_WEEKLY_ADJUSTED&symbol=TSLA"). 134 | to_return(status: 200, body: file_fixture("time_series/weekly_adjusted.json"), headers: {}) 135 | end 136 | 137 | it 'returns meta data' do 138 | expect(subject.meta_data).to have_attributes({ 139 | information: "Weekly Adjusted Prices and Volumes", 140 | last_refreshed: "2021-04-23", 141 | symbol: "TSLA", 142 | time_zone: "US/Eastern" 143 | }) 144 | end 145 | 146 | it 'returns weekly adjusted time series' do 147 | expect(subject.weekly_adjusted_time_series["2021-04-23"]).to have_attributes({ 148 | close: "729.4000", 149 | high: "753.7700", 150 | low: "691.8001", 151 | volume: "169804356", 152 | adjusted_close: "729.4000", 153 | dividend_amount: "0.0000" 154 | }) 155 | expect(subject.weekly_adjusted_time_series["2021-04-23"].open).to eq("719.6000") 156 | end 157 | end 158 | end 159 | 160 | describe '#daily' do 161 | subject { described_class.new(symbol: 'TSLA').daily } 162 | before do 163 | stub_request(:get, "https://www.alphavantage.co/query?apikey=someKey&function=TIME_SERIES_DAILY&outputsize=compact&symbol=TSLA"). 164 | to_return(status: 200, body: file_fixture("time_series/daily.json"), headers: {}) 165 | end 166 | 167 | it 'returns meta data' do 168 | expect(subject.meta_data).to have_attributes({ 169 | information: "Daily Prices (open, high, low, close) and Volumes", 170 | last_refreshed: "2021-04-23", 171 | symbol: "TSLA", 172 | output_size: "Compact", 173 | time_zone: "US/Eastern" 174 | }) 175 | end 176 | 177 | it 'returns daily time series' do 178 | expect(subject.time_series_daily["2021-04-23"]).to have_attributes({ 179 | close: "729.4000", 180 | high: "737.3600", 181 | low: "715.4600", 182 | volume: "27703323" 183 | }) 184 | expect(subject.time_series_daily["2021-04-23"].open).to eq("719.8000") 185 | end 186 | 187 | context 'when invalid outputsize given' do 188 | subject { described_class.new(symbol: 'TSLA').daily(outputsize: 'invalid') } 189 | it 'should raise error' do 190 | expect { subject }.to raise_error(Alphavantage::Error, /Invalid outputsize given./) 191 | end 192 | end 193 | 194 | context 'when adjusted' do 195 | subject { described_class.new(symbol: 'TSLA').daily(adjusted: true) } 196 | before do 197 | stub_request(:get, "https://www.alphavantage.co/query?apikey=someKey&function=TIME_SERIES_DAILY_ADJUSTED&outputsize=compact&symbol=TSLA"). 198 | to_return(status: 200, body: file_fixture("time_series/daily_adjusted.json"), headers: {}) 199 | end 200 | 201 | it 'returns meta data' do 202 | expect(subject.meta_data).to have_attributes({ 203 | information: "Daily Time Series with Splits and Dividend Events", 204 | last_refreshed: "2021-04-23", 205 | symbol: "TSLA", 206 | output_size: "Compact", 207 | time_zone: "US/Eastern" 208 | }) 209 | end 210 | 211 | it 'returns daily adjusted time series' do 212 | expect(subject.time_series_daily["2021-04-23"]).to have_attributes({ 213 | close: "729.4", 214 | high: "737.36", 215 | low: "715.46", 216 | volume: "27703323", 217 | adjusted_close: "729.4", 218 | dividend_amount: "0.0000", 219 | split_coefficient: "1.0" 220 | }) 221 | expect(subject.time_series_daily["2021-04-23"].open).to eq("719.8") 222 | end 223 | end 224 | end 225 | 226 | describe '#intraday' do 227 | context 'datatype: json' do 228 | subject { described_class.new(symbol: 'TSLA').intraday } 229 | before do 230 | stub_request(:get, "https://www.alphavantage.co/query?adjusted=true&apikey=someKey&datatype=json&function=TIME_SERIES_INTRADAY&interval=5min&outputsize=compact&symbol=TSLA"). 231 | to_return(status: 200, body: file_fixture("time_series/intraday.json"), headers: {}) 232 | end 233 | 234 | it 'returns meta data' do 235 | expect(subject.meta_data).to have_attributes({ 236 | information: "Intraday (5min) open, high, low, close prices and volume", 237 | last_refreshed: "2021-04-23 20:00:00", 238 | symbol: "TSLA", 239 | output_size: "Compact", 240 | time_zone: "US/Eastern" 241 | }) 242 | end 243 | 244 | it 'returns daily time series' do 245 | expect(subject.time_series_5min["2021-04-23 20:00:00"]).to have_attributes({ 246 | close: "730.1000", 247 | high: "730.5000", 248 | low: "730.1000", 249 | volume: "5637" 250 | }) 251 | expect(subject.time_series_5min["2021-04-23 20:00:00"].open).to eq("730.2500") 252 | end 253 | 254 | context 'when invalid outputsize given' do 255 | subject { described_class.new(symbol: 'TSLA').intraday(outputsize: 'invalid') } 256 | it 'should raise error' do 257 | expect { subject }.to raise_error(Alphavantage::Error, /Invalid outputsize given./) 258 | end 259 | end 260 | 261 | context 'when invalid interval given' do 262 | subject { described_class.new(symbol: 'TSLA').intraday(interval: '100min') } 263 | it 'should raise error' do 264 | expect { subject }.to raise_error(Alphavantage::Error, /Invalid interval given./) 265 | end 266 | end 267 | 268 | context 'when invalid datatype given' do 269 | subject { described_class.new(symbol: 'TSLA').intraday(datatype: 'wrong') } 270 | it 'should raise error' do 271 | expect { subject }.to raise_error(Alphavantage::Error, /Invalid data type given./) 272 | end 273 | end 274 | end 275 | 276 | context 'datatype: csv' do 277 | subject { described_class.new(symbol: 'TSLA').intraday datatype: 'csv' } 278 | 279 | before do 280 | stub_request(:get, "https://www.alphavantage.co/query?adjusted=true&apikey=someKey&datatype=csv&function=TIME_SERIES_INTRADAY&interval=5min&outputsize=compact&symbol=TSLA"). 281 | to_return(status: 200, body: file_fixture("time_series/intraday.csv"), headers: {}) 282 | end 283 | 284 | # do not need to test further, cos we are testing out fixture 285 | it 'returns CSV caption' do 286 | expect(subject.first).to match_array %w[timestamp open high low close volume] 287 | end 288 | end 289 | end 290 | 291 | describe '#intraday_extended_history' do 292 | subject { described_class.new(symbol: 'TSLA').intraday_extended_history } 293 | 294 | before do 295 | stub_request(:get, "https://www.alphavantage.co/query?adjusted=true&apikey=someKey&function=TIME_SERIES_INTRADAY_EXTENDED&interval=5min&slice=year1month1&symbol=TSLA"). 296 | to_return(status: 200, body: file_fixture("time_series/intraday_extended_history.csv"), headers: {}) 297 | end 298 | 299 | # do not need to test further, cos we are testing out fixture 300 | it 'returns CSV caption' do 301 | expect(subject.first).to match_array %w[time open high low close volume] 302 | end 303 | end 304 | end -------------------------------------------------------------------------------- /spec/alphavantage_spec.rb: -------------------------------------------------------------------------------- 1 | RSpec.describe Alphavantage do 2 | it "has a version number" do 3 | expect(Alphavantage::VERSION).not_to be nil 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /spec/fixtures/crypto/daily.json: -------------------------------------------------------------------------------- 1 | { 2 | "Meta Data": { 3 | "1. Information": "Daily Prices and Volumes for Digital Currency", 4 | "2. Digital Currency Code": "BTC", 5 | "3. Digital Currency Name": "Bitcoin", 6 | "4. Market Code": "CNY", 7 | "5. Market Name": "Chinese Yuan", 8 | "6. Last Refreshed": "2021-04-25 00:00:00", 9 | "7. Time Zone": "UTC" 10 | }, 11 | "Time Series (Digital Currency Daily)": { 12 | "2021-04-25": { 13 | "1a. open (CNY)": "325140.79734400", 14 | "1b. open (USD)": "50047.84000000", 15 | "2a. high (CNY)": "326792.94769000", 16 | "2b. high (USD)": "50302.15000000", 17 | "3a. low (CNY)": "323866.81408400", 18 | "3b. low (USD)": "49851.74000000", 19 | "4a. close (CNY)": "325812.48081800", 20 | "4b. close (USD)": "50151.23000000", 21 | "5. volume": "1758.54534700", 22 | "6. market cap (USD)": "1758.54534700" 23 | }, 24 | "2021-04-24": { 25 | "1a. open (CNY)": "332044.86409600", 26 | "1b. open (USD)": "51110.56000000", 27 | "2a. high (CNY)": "332406.46485200", 28 | "2b. high (USD)": "51166.22000000", 29 | "3a. low (CNY)": "316105.97572400", 30 | "3b. low (USD)": "48657.14000000", 31 | "4a. close (CNY)": "325140.79734400", 32 | "4b. close (USD)": "50047.84000000", 33 | "5. volume": "55361.51257300", 34 | "6. market cap (USD)": "55361.51257300" 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /spec/fixtures/crypto/health_index.json: -------------------------------------------------------------------------------- 1 | { 2 | "Crypto Rating (FCAS)": { 3 | "1. symbol": "BTC", 4 | "2. name": "Bitcoin", 5 | "3. fcas rating": "Attractive", 6 | "4. fcas score": "887", 7 | "5. developer score": "831", 8 | "6. market maturity score": "877", 9 | "7. utility score": "960", 10 | "8. last refreshed": "2021-04-24 00:00:00", 11 | "9. timezone": "UTC" 12 | } 13 | } -------------------------------------------------------------------------------- /spec/fixtures/crypto/intraday.json: -------------------------------------------------------------------------------- 1 | { 2 | "Meta Data": { 3 | "1. Information": "Crypto Intraday (5min) Time Series", 4 | "2. Digital Currency Code": "ETH", 5 | "3. Digital Currency Name": "Ethereum", 6 | "4. Market Code": "USD", 7 | "5. Market Name": "United States Dollar", 8 | "6. Last Refreshed": "2021-04-25 15:45:00", 9 | "7. Interval": "5min", 10 | "8. Output Size": "Compact", 11 | "9. Time Zone": "UTC" 12 | }, 13 | "Time Series Crypto (5min)": { 14 | "2021-04-25 15:45:00": { 15 | "1. open": "2339.76000", 16 | "2. high": "2342.00000", 17 | "3. low": "2334.42000", 18 | "4. close": "2340.22000", 19 | "5. volume": 1367 20 | }, 21 | "2021-04-25 15:40:00": { 22 | "1. open": "2339.20000", 23 | "2. high": "2346.00000", 24 | "3. low": "2338.45000", 25 | "4. close": "2339.77000", 26 | "5. volume": 2328 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /spec/fixtures/crypto/monthly.json: -------------------------------------------------------------------------------- 1 | { 2 | "Meta Data": { 3 | "1. Information": "Monthly Prices and Volumes for Digital Currency", 4 | "2. Digital Currency Code": "BTC", 5 | "3. Digital Currency Name": "Bitcoin", 6 | "4. Market Code": "CNY", 7 | "5. Market Name": "Chinese Yuan", 8 | "6. Last Refreshed": "2021-04-25 00:00:00", 9 | "7. Time Zone": "UTC" 10 | }, 11 | "Time Series (Digital Currency Monthly)": { 12 | "2021-04-25": { 13 | "1a. open (CNY)": "381606.77583600", 14 | "1b. open (USD)": "58739.46000000", 15 | "2a. high (CNY)": "421330.49640000", 16 | "2b. high (USD)": "64854.00000000", 17 | "3a. low (CNY)": "308588.50000000", 18 | "3b. low (USD)": "47500.00000000", 19 | "4a. close (CNY)": "325812.48081800", 20 | "4b. close (USD)": "50151.23000000", 21 | "5. volume": "1620401.61304000", 22 | "6. market cap (USD)": "1620401.61304000" 23 | }, 24 | "2021-03-31": { 25 | "1a. open (CNY)": "293218.25902600", 26 | "1b. open (USD)": "45134.11000000", 27 | "2a. high (CNY)": "401775.73040000", 28 | "2b. high (USD)": "61844.00000000", 29 | "3a. low (CNY)": "292025.61319800", 30 | "3b. low (USD)": "44950.53000000", 31 | "4a. close (CNY)": "381613.85713000", 32 | "4b. close (USD)": "58740.55000000", 33 | "5. volume": "2098808.02743000", 34 | "6. market cap (USD)": "2098808.02743000" 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /spec/fixtures/crypto/weekly.json: -------------------------------------------------------------------------------- 1 | { 2 | "Meta Data": { 3 | "1. Information": "Weekly Prices and Volumes for Digital Currency", 4 | "2. Digital Currency Code": "BTC", 5 | "3. Digital Currency Name": "Bitcoin", 6 | "4. Market Code": "CNY", 7 | "5. Market Name": "Chinese Yuan", 8 | "6. Last Refreshed": "2021-04-25 00:00:00", 9 | "7. Time Zone": "UTC" 10 | }, 11 | "Time Series (Digital Currency Weekly)": { 12 | "2021-04-25": { 13 | "1a. open (CNY)": "364784.15496600", 14 | "1b. open (USD)": "56150.01000000", 15 | "2a. high (CNY)": "373728.67384600", 16 | "2b. high (USD)": "57526.81000000", 17 | "3a. low (CNY)": "308588.50000000", 18 | "3b. low (USD)": "47500.00000000", 19 | "4a. close (CNY)": "325812.48081800", 20 | "4b. close (USD)": "50151.23000000", 21 | "5. volume": "511965.75130300", 22 | "6. market cap (USD)": "511965.75130300" 23 | }, 24 | "2021-04-18": { 25 | "1a. open (CNY)": "389788.20408000", 26 | "1b. open (USD)": "59998.80000000", 27 | "2a. high (CNY)": "421330.49640000", 28 | "2b. high (USD)": "64854.00000000", 29 | "3a. low (CNY)": "330880.28358000", 30 | "3b. low (USD)": "50931.30000000", 31 | "4a. close (CNY)": "364784.15496600", 32 | "4b. close (USD)": "56150.01000000", 33 | "5. volume": "549048.29803200", 34 | "6. market cap (USD)": "549048.29803200" 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /spec/fixtures/forex/daily.json: -------------------------------------------------------------------------------- 1 | { 2 | "Meta Data": { 3 | "1. Information": "Forex Daily Prices (open, high, low, close)", 4 | "2. From Symbol": "EUR", 5 | "3. To Symbol": "USD", 6 | "4. Output Size": "Compact", 7 | "5. Last Refreshed": "2021-04-23 21:55:00", 8 | "6. Time Zone": "UTC" 9 | }, 10 | "Time Series FX (Daily)": { 11 | "2021-04-23": { 12 | "1. open": "1.20142", 13 | "2. high": "1.21000", 14 | "3. low": "1.20110", 15 | "4. close": "1.20965" 16 | }, 17 | "2021-04-22": { 18 | "1. open": "1.20354", 19 | "2. high": "1.20697", 20 | "3. low": "1.19920", 21 | "4. close": "1.20156" 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /spec/fixtures/forex/exchange_rates.json: -------------------------------------------------------------------------------- 1 | { 2 | "Realtime Currency Exchange Rate": { 3 | "1. From_Currency Code": "USD", 4 | "2. From_Currency Name": "United States Dollar", 5 | "3. To_Currency Code": "JPY", 6 | "4. To_Currency Name": "Japanese Yen", 7 | "5. Exchange Rate": "107.86500000", 8 | "6. Last Refreshed": "2021-04-25 02:21:59", 9 | "7. Time Zone": "UTC", 10 | "8. Bid Price": "107.86060000", 11 | "9. Ask Price": "107.86930000" 12 | } 13 | } -------------------------------------------------------------------------------- /spec/fixtures/forex/intraday.json: -------------------------------------------------------------------------------- 1 | { 2 | "Meta Data": { 3 | "1. Information": "FX Intraday (5min) Time Series", 4 | "2. From Symbol": "EUR", 5 | "3. To Symbol": "USD", 6 | "4. Last Refreshed": "2021-04-23 21:55:00", 7 | "5. Interval": "5min", 8 | "6. Output Size": "Compact", 9 | "7. Time Zone": "UTC" 10 | }, 11 | "Time Series FX (5min)": { 12 | "2021-04-23 21:55:00": { 13 | "1. open": "1.20965", 14 | "2. high": "1.20965", 15 | "3. low": "1.20965", 16 | "4. close": "1.20965" 17 | }, 18 | "2021-04-23 21:50:00": { 19 | "1. open": "1.20965", 20 | "2. high": "1.20965", 21 | "3. low": "1.20965", 22 | "4. close": "1.20965" 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /spec/fixtures/forex/monthly.json: -------------------------------------------------------------------------------- 1 | { 2 | "Meta Data": { 3 | "1. Information": "Forex Monthly Prices (open, high, low, close)", 4 | "2. From Symbol": "EUR", 5 | "3. To Symbol": "USD", 6 | "4. Last Refreshed": "2021-04-23 21:55:00", 7 | "5. Time Zone": "UTC" 8 | }, 9 | "Time Series FX (Monthly)": { 10 | "2021-04-23": { 11 | "1. open": "1.17260", 12 | "2. high": "1.21000", 13 | "3. low": "1.17110", 14 | "4. close": "1.20965" 15 | }, 16 | "2021-03-31": { 17 | "1. open": "1.20718", 18 | "2. high": "1.21133", 19 | "3. low": "1.17020", 20 | "4. close": "1.17266" 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /spec/fixtures/forex/weekly.json: -------------------------------------------------------------------------------- 1 | { 2 | "Meta Data": { 3 | "1. Information": "Forex Weekly Prices (open, high, low, close)", 4 | "2. From Symbol": "EUR", 5 | "3. To Symbol": "USD", 6 | "4. Last Refreshed": "2021-04-23 21:55:00", 7 | "5. Time Zone": "UTC" 8 | }, 9 | "Time Series FX (Weekly)": { 10 | "2021-04-23": { 11 | "1. open": "1.19752", 12 | "2. high": "1.21000", 13 | "3. low": "1.19410", 14 | "4. close": "1.20965" 15 | }, 16 | "2021-04-16": { 17 | "1. open": "1.18963", 18 | "2. high": "1.19948", 19 | "3. low": "1.18690", 20 | "4. close": "1.19823" 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /spec/fixtures/fundamental/cash_flow.json: -------------------------------------------------------------------------------- 1 | { 2 | "symbol": "TSLA", 3 | "annualReports": [ 4 | { 5 | "fiscalDateEnding": "2020-12-31", 6 | "reportedCurrency": "USD", 7 | "operatingCashflow": "5943000000", 8 | "paymentsForOperatingActivities": "1115000000", 9 | "proceedsFromOperatingActivities": "None", 10 | "changeInOperatingLiabilities": "2918000000", 11 | "changeInOperatingAssets": "1669000000", 12 | "depreciationDepletionAndAmortization": "2149000000", 13 | "capitalExpenditures": "3167000000", 14 | "changeInReceivables": "652000000", 15 | "changeInInventory": "422000000", 16 | "profitLoss": "862000000", 17 | "cashflowFromInvestment": "-3132000000", 18 | "cashflowFromFinancing": "9973000000", 19 | "proceedsFromRepaymentsOfShortTermDebt": "None", 20 | "paymentsForRepurchaseOfCommonStock": "None", 21 | "paymentsForRepurchaseOfEquity": "None", 22 | "paymentsForRepurchaseOfPreferredStock": "None", 23 | "dividendPayout": "None", 24 | "dividendPayoutCommonStock": "None", 25 | "dividendPayoutPreferredStock": "None", 26 | "proceedsFromIssuanceOfCommonStock": "12269000000", 27 | "proceedsFromIssuanceOfLongTermDebtAndCapitalSecuritiesNet": "None", 28 | "proceedsFromIssuanceOfPreferredStock": "None", 29 | "proceedsFromRepurchaseOfEquity": "12686000000", 30 | "proceedsFromSaleOfTreasuryStock": "None", 31 | "changeInCashAndCashEquivalents": "12784000000", 32 | "changeInExchangeRate": "None", 33 | "netIncome": "721000000" 34 | }, 35 | { 36 | "fiscalDateEnding": "2019-12-31", 37 | "reportedCurrency": "USD", 38 | "operatingCashflow": "2405000000", 39 | "paymentsForOperatingActivities": "1009000000", 40 | "proceedsFromOperatingActivities": "None", 41 | "changeInOperatingLiabilities": "1442000000", 42 | "changeInOperatingAssets": "969000000", 43 | "depreciationDepletionAndAmortization": "1901000000", 44 | "capitalExpenditures": "1332000000", 45 | "changeInReceivables": "367000000", 46 | "changeInInventory": "429000000", 47 | "profitLoss": "-775000000", 48 | "cashflowFromInvestment": "-1436000000", 49 | "cashflowFromFinancing": "1529000000", 50 | "proceedsFromRepaymentsOfShortTermDebt": "None", 51 | "paymentsForRepurchaseOfCommonStock": "None", 52 | "paymentsForRepurchaseOfEquity": "None", 53 | "paymentsForRepurchaseOfPreferredStock": "None", 54 | "dividendPayout": "None", 55 | "dividendPayoutCommonStock": "None", 56 | "dividendPayoutPreferredStock": "None", 57 | "proceedsFromIssuanceOfCommonStock": "848000000", 58 | "proceedsFromIssuanceOfLongTermDebtAndCapitalSecuritiesNet": "None", 59 | "proceedsFromIssuanceOfPreferredStock": "174000000", 60 | "proceedsFromRepurchaseOfEquity": "1285000000", 61 | "proceedsFromSaleOfTreasuryStock": "None", 62 | "changeInCashAndCashEquivalents": "2498000000", 63 | "changeInExchangeRate": "None", 64 | "netIncome": "-862000000" 65 | }, 66 | { 67 | "fiscalDateEnding": "2018-12-31", 68 | "reportedCurrency": "USD", 69 | "operatingCashflow": "2098000000", 70 | "paymentsForOperatingActivities": "443000000", 71 | "proceedsFromOperatingActivities": "None", 72 | "changeInOperatingLiabilities": "2178000000", 73 | "changeInOperatingAssets": "1809000000", 74 | "depreciationDepletionAndAmortization": "1335000000", 75 | "capitalExpenditures": "2101000000", 76 | "changeInReceivables": "497000000", 77 | "changeInInventory": "1023000000", 78 | "profitLoss": "-1063333000", 79 | "cashflowFromInvestment": "-2337000000", 80 | "cashflowFromFinancing": "574000000", 81 | "proceedsFromRepaymentsOfShortTermDebt": "None", 82 | "paymentsForRepurchaseOfCommonStock": "None", 83 | "paymentsForRepurchaseOfEquity": "11000", 84 | "paymentsForRepurchaseOfPreferredStock": "None", 85 | "dividendPayout": "None", 86 | "dividendPayoutCommonStock": "None", 87 | "dividendPayoutPreferredStock": "None", 88 | "proceedsFromIssuanceOfCommonStock": "None", 89 | "proceedsFromIssuanceOfLongTermDebtAndCapitalSecuritiesNet": "None", 90 | "proceedsFromIssuanceOfPreferredStock": "None", 91 | "proceedsFromRepurchaseOfEquity": "296000000", 92 | "proceedsFromSaleOfTreasuryStock": "None", 93 | "changeInCashAndCashEquivalents": "335000000", 94 | "changeInExchangeRate": "None", 95 | "netIncome": "-976000000" 96 | }, 97 | { 98 | "fiscalDateEnding": "2017-12-31", 99 | "reportedCurrency": "USD", 100 | "operatingCashflow": "-61000000", 101 | "paymentsForOperatingActivities": "249000000", 102 | "proceedsFromOperatingActivities": "None", 103 | "changeInOperatingLiabilities": "938000000", 104 | "changeInOperatingAssets": "291000000", 105 | "depreciationDepletionAndAmortization": "769300000", 106 | "capitalExpenditures": "3415000000", 107 | "changeInReceivables": "25000000", 108 | "changeInInventory": "179000000", 109 | "profitLoss": "-2241000000", 110 | "cashflowFromInvestment": "-4196000000", 111 | "cashflowFromFinancing": "4415000000", 112 | "proceedsFromRepaymentsOfShortTermDebt": "511321000", 113 | "paymentsForRepurchaseOfCommonStock": "None", 114 | "paymentsForRepurchaseOfEquity": "230000000", 115 | "paymentsForRepurchaseOfPreferredStock": "None", 116 | "dividendPayout": "None", 117 | "dividendPayoutCommonStock": "None", 118 | "dividendPayoutPreferredStock": "None", 119 | "proceedsFromIssuanceOfCommonStock": "400000000", 120 | "proceedsFromIssuanceOfLongTermDebtAndCapitalSecuritiesNet": "None", 121 | "proceedsFromIssuanceOfPreferredStock": "53000000", 122 | "proceedsFromRepurchaseOfEquity": "482000000", 123 | "proceedsFromSaleOfTreasuryStock": "None", 124 | "changeInCashAndCashEquivalents": "-25302000", 125 | "changeInExchangeRate": "39455000", 126 | "netIncome": "-1961400000" 127 | }, 128 | { 129 | "fiscalDateEnding": "2016-12-31", 130 | "reportedCurrency": "USD", 131 | "operatingCashflow": "-123829000", 132 | "paymentsForOperatingActivities": "55078000", 133 | "proceedsFromOperatingActivities": "None", 134 | "changeInOperatingLiabilities": "1265659000", 135 | "changeInOperatingAssets": "792626000", 136 | "depreciationDepletionAndAmortization": "477300000", 137 | "capitalExpenditures": "1280802000", 138 | "changeInReceivables": "216565000", 139 | "changeInInventory": "632867000", 140 | "profitLoss": "-773046000", 141 | "cashflowFromInvestment": "-1081085000", 142 | "cashflowFromFinancing": "3743976000", 143 | "proceedsFromRepaymentsOfShortTermDebt": "769709000", 144 | "paymentsForRepurchaseOfCommonStock": "None", 145 | "paymentsForRepurchaseOfEquity": "None", 146 | "paymentsForRepurchaseOfPreferredStock": "None", 147 | "dividendPayout": "None", 148 | "dividendPayoutCommonStock": "None", 149 | "dividendPayoutPreferredStock": "None", 150 | "proceedsFromIssuanceOfCommonStock": "1701734000", 151 | "proceedsFromIssuanceOfLongTermDebtAndCapitalSecuritiesNet": "None", 152 | "proceedsFromIssuanceOfPreferredStock": "None", 153 | "proceedsFromRepurchaseOfEquity": "1865551000", 154 | "proceedsFromSaleOfTreasuryStock": "None", 155 | "changeInCashAndCashEquivalents": "2196308000", 156 | "changeInExchangeRate": "-7409000", 157 | "netIncome": "-674914000" 158 | } 159 | ], 160 | "quarterlyReports": [ 161 | { 162 | "fiscalDateEnding": "2020-12-31", 163 | "reportedCurrency": "USD", 164 | "operatingCashflow": "3019000000", 165 | "paymentsForOperatingActivities": "None", 166 | "proceedsFromOperatingActivities": "None", 167 | "changeInOperatingLiabilities": "1774000000", 168 | "changeInOperatingAssets": "122000000", 169 | "depreciationDepletionAndAmortization": "875000000", 170 | "capitalExpenditures": "1156000000", 171 | "changeInReceivables": "102000000", 172 | "changeInInventory": "-180000000", 173 | "profitLoss": "296000000", 174 | "cashflowFromInvestment": "-1047000000", 175 | "cashflowFromFinancing": "2692000000", 176 | "proceedsFromRepaymentsOfShortTermDebt": "None", 177 | "paymentsForRepurchaseOfCommonStock": "None", 178 | "paymentsForRepurchaseOfEquity": "None", 179 | "paymentsForRepurchaseOfPreferredStock": "None", 180 | "dividendPayout": "None", 181 | "dividendPayoutCommonStock": "None", 182 | "dividendPayoutPreferredStock": "None", 183 | "proceedsFromIssuanceOfCommonStock": "4987000000", 184 | "proceedsFromIssuanceOfLongTermDebtAndCapitalSecuritiesNet": "None", 185 | "proceedsFromIssuanceOfPreferredStock": "None", 186 | "proceedsFromRepurchaseOfEquity": "5043000000", 187 | "proceedsFromSaleOfTreasuryStock": "None", 188 | "changeInCashAndCashEquivalents": "4664000000", 189 | "changeInExchangeRate": "None", 190 | "netIncome": "270000000" 191 | }, 192 | { 193 | "fiscalDateEnding": "2020-09-30", 194 | "reportedCurrency": "USD", 195 | "operatingCashflow": "2400000000", 196 | "paymentsForOperatingActivities": "None", 197 | "proceedsFromOperatingActivities": "None", 198 | "changeInOperatingLiabilities": "1424000000", 199 | "changeInOperatingAssets": "459000000", 200 | "depreciationDepletionAndAmortization": "453000000", 201 | "capitalExpenditures": "1010000000", 202 | "changeInReceivables": "314000000", 203 | "changeInInventory": "67000000", 204 | "profitLoss": "369000000", 205 | "cashflowFromInvestment": "-1039000000", 206 | "cashflowFromFinancing": "4450000000", 207 | "proceedsFromRepaymentsOfShortTermDebt": "None", 208 | "paymentsForRepurchaseOfCommonStock": "None", 209 | "paymentsForRepurchaseOfEquity": "None", 210 | "paymentsForRepurchaseOfPreferredStock": "None", 211 | "dividendPayout": "None", 212 | "dividendPayoutCommonStock": "None", 213 | "dividendPayoutPreferredStock": "None", 214 | "proceedsFromIssuanceOfCommonStock": "4973000000", 215 | "proceedsFromIssuanceOfLongTermDebtAndCapitalSecuritiesNet": "None", 216 | "proceedsFromIssuanceOfPreferredStock": "None", 217 | "proceedsFromRepurchaseOfEquity": "5117000000", 218 | "proceedsFromSaleOfTreasuryStock": "None", 219 | "changeInCashAndCashEquivalents": "5811000000", 220 | "changeInExchangeRate": "None", 221 | "netIncome": "331000000" 222 | }, 223 | { 224 | "fiscalDateEnding": "2020-06-30", 225 | "reportedCurrency": "USD", 226 | "operatingCashflow": "964000000", 227 | "paymentsForOperatingActivities": "None", 228 | "proceedsFromOperatingActivities": "None", 229 | "changeInOperatingLiabilities": "-51000000", 230 | "changeInOperatingAssets": "-21000000", 231 | "depreciationDepletionAndAmortization": "402000000", 232 | "capitalExpenditures": "546000000", 233 | "changeInReceivables": "222000000", 234 | "changeInInventory": "-446000000", 235 | "profitLoss": "129000000", 236 | "cashflowFromInvestment": "-566000000", 237 | "cashflowFromFinancing": "123000000", 238 | "proceedsFromRepaymentsOfShortTermDebt": "None", 239 | "paymentsForRepurchaseOfCommonStock": "None", 240 | "paymentsForRepurchaseOfEquity": "None", 241 | "paymentsForRepurchaseOfPreferredStock": "None", 242 | "dividendPayout": "None", 243 | "dividendPayoutCommonStock": "None", 244 | "dividendPayoutPreferredStock": "None", 245 | "proceedsFromIssuanceOfCommonStock": "0", 246 | "proceedsFromIssuanceOfLongTermDebtAndCapitalSecuritiesNet": "None", 247 | "proceedsFromIssuanceOfPreferredStock": "None", 248 | "proceedsFromRepurchaseOfEquity": "57000000", 249 | "proceedsFromSaleOfTreasuryStock": "None", 250 | "changeInCashAndCashEquivalents": "1267000000", 251 | "changeInExchangeRate": "None", 252 | "netIncome": "104000000" 253 | }, 254 | { 255 | "fiscalDateEnding": "2020-03-31", 256 | "reportedCurrency": "USD", 257 | "operatingCashflow": "-440000000", 258 | "paymentsForOperatingActivities": "None", 259 | "proceedsFromOperatingActivities": "None", 260 | "changeInOperatingLiabilities": "-229000000", 261 | "changeInOperatingAssets": "1109000000", 262 | "depreciationDepletionAndAmortization": "417000000", 263 | "capitalExpenditures": "455000000", 264 | "changeInReceivables": "14000000", 265 | "changeInInventory": "981000000", 266 | "profitLoss": "68000000", 267 | "cashflowFromInvestment": "-480000000", 268 | "cashflowFromFinancing": "2708000000", 269 | "proceedsFromRepaymentsOfShortTermDebt": "None", 270 | "paymentsForRepurchaseOfCommonStock": "None", 271 | "paymentsForRepurchaseOfEquity": "None", 272 | "paymentsForRepurchaseOfPreferredStock": "None", 273 | "dividendPayout": "None", 274 | "dividendPayoutCommonStock": "None", 275 | "dividendPayoutPreferredStock": "None", 276 | "proceedsFromIssuanceOfCommonStock": "2309000000", 277 | "proceedsFromIssuanceOfLongTermDebtAndCapitalSecuritiesNet": "None", 278 | "proceedsFromIssuanceOfPreferredStock": "None", 279 | "proceedsFromRepurchaseOfEquity": "2469000000", 280 | "proceedsFromSaleOfTreasuryStock": "None", 281 | "changeInCashAndCashEquivalents": "1234000000", 282 | "changeInExchangeRate": "None", 283 | "netIncome": "16000000" 284 | }, 285 | { 286 | "fiscalDateEnding": "2019-12-31", 287 | "reportedCurrency": "USD", 288 | "operatingCashflow": "1425000000", 289 | "paymentsForOperatingActivities": "None", 290 | "proceedsFromOperatingActivities": "None", 291 | "changeInOperatingLiabilities": "616000000", 292 | "changeInOperatingAssets": "144000000", 293 | "depreciationDepletionAndAmortization": "776000000", 294 | "capitalExpenditures": "412000000", 295 | "changeInReceivables": "217000000", 296 | "changeInInventory": "-56000000", 297 | "profitLoss": "132000000", 298 | "cashflowFromInvestment": "-403000000", 299 | "cashflowFromFinancing": "-79000000", 300 | "proceedsFromRepaymentsOfShortTermDebt": "None", 301 | "paymentsForRepurchaseOfCommonStock": "None", 302 | "paymentsForRepurchaseOfEquity": "None", 303 | "paymentsForRepurchaseOfPreferredStock": "None", 304 | "dividendPayout": "None", 305 | "dividendPayoutCommonStock": "None", 306 | "dividendPayoutPreferredStock": "None", 307 | "proceedsFromIssuanceOfCommonStock": "None", 308 | "proceedsFromIssuanceOfLongTermDebtAndCapitalSecuritiesNet": "None", 309 | "proceedsFromIssuanceOfPreferredStock": "None", 310 | "proceedsFromRepurchaseOfEquity": "96000000", 311 | "proceedsFromSaleOfTreasuryStock": "None", 312 | "changeInCashAndCashEquivalents": "943000000", 313 | "changeInExchangeRate": "None", 314 | "netIncome": "105000000" 315 | }, 316 | { 317 | "fiscalDateEnding": "2019-09-30", 318 | "reportedCurrency": "USD", 319 | "operatingCashflow": "756000000", 320 | "paymentsForOperatingActivities": "None", 321 | "proceedsFromOperatingActivities": "None", 322 | "changeInOperatingLiabilities": "261000000", 323 | "changeInOperatingAssets": "208000000", 324 | "depreciationDepletionAndAmortization": "409000000", 325 | "capitalExpenditures": "385000000", 326 | "changeInReceivables": "-18000000", 327 | "changeInInventory": "133000000", 328 | "profitLoss": "150000000", 329 | "cashflowFromInvestment": "-486000000", 330 | "cashflowFromFinancing": "118000000", 331 | "proceedsFromRepaymentsOfShortTermDebt": "None", 332 | "paymentsForRepurchaseOfCommonStock": "None", 333 | "paymentsForRepurchaseOfEquity": "None", 334 | "paymentsForRepurchaseOfPreferredStock": "None", 335 | "dividendPayout": "None", 336 | "dividendPayoutCommonStock": "None", 337 | "dividendPayoutPreferredStock": "None", 338 | "proceedsFromIssuanceOfCommonStock": "None", 339 | "proceedsFromIssuanceOfLongTermDebtAndCapitalSecuritiesNet": "None", 340 | "proceedsFromIssuanceOfPreferredStock": "None", 341 | "proceedsFromRepurchaseOfEquity": "71000000", 342 | "proceedsFromSaleOfTreasuryStock": "None", 343 | "changeInCashAndCashEquivalents": "388000000", 344 | "changeInExchangeRate": "None", 345 | "netIncome": "143000000" 346 | }, 347 | { 348 | "fiscalDateEnding": "2019-06-30", 349 | "reportedCurrency": "USD", 350 | "operatingCashflow": "864000000", 351 | "paymentsForOperatingActivities": "None", 352 | "proceedsFromOperatingActivities": "None", 353 | "changeInOperatingLiabilities": "302000000", 354 | "changeInOperatingAssets": "-310000000", 355 | "depreciationDepletionAndAmortization": "369000000", 356 | "capitalExpenditures": "255000000", 357 | "changeInReceivables": "68000000", 358 | "changeInInventory": "-457000000", 359 | "profitLoss": "-389000000", 360 | "cashflowFromInvestment": "-241000000", 361 | "cashflowFromFinancing": "2143000000", 362 | "proceedsFromRepaymentsOfShortTermDebt": "None", 363 | "paymentsForRepurchaseOfCommonStock": "None", 364 | "paymentsForRepurchaseOfEquity": "None", 365 | "paymentsForRepurchaseOfPreferredStock": "None", 366 | "dividendPayout": "63502000", 367 | "dividendPayoutCommonStock": "63502000", 368 | "dividendPayoutPreferredStock": "None", 369 | "proceedsFromIssuanceOfCommonStock": "None", 370 | "proceedsFromIssuanceOfLongTermDebtAndCapitalSecuritiesNet": "None", 371 | "proceedsFromIssuanceOfPreferredStock": "None", 372 | "proceedsFromRepurchaseOfEquity": "1040000000", 373 | "proceedsFromSaleOfTreasuryStock": "None", 374 | "changeInCashAndCashEquivalents": "921000000", 375 | "changeInExchangeRate": "None", 376 | "netIncome": "-408000000" 377 | }, 378 | { 379 | "fiscalDateEnding": "2019-03-31", 380 | "reportedCurrency": "USD", 381 | "operatingCashflow": "-640000000", 382 | "paymentsForOperatingActivities": "None", 383 | "proceedsFromOperatingActivities": "None", 384 | "changeInOperatingLiabilities": "263000000", 385 | "changeInOperatingAssets": "927000000", 386 | "depreciationDepletionAndAmortization": "339000000", 387 | "capitalExpenditures": "280000000", 388 | "changeInReceivables": "100000000", 389 | "changeInInventory": "809000000", 390 | "profitLoss": "-668000000", 391 | "cashflowFromInvestment": "-306000000", 392 | "cashflowFromFinancing": "-653000000", 393 | "proceedsFromRepaymentsOfShortTermDebt": "None", 394 | "paymentsForRepurchaseOfCommonStock": "None", 395 | "paymentsForRepurchaseOfEquity": "None", 396 | "paymentsForRepurchaseOfPreferredStock": "None", 397 | "dividendPayout": "85257000", 398 | "dividendPayoutCommonStock": "85257000", 399 | "dividendPayoutPreferredStock": "None", 400 | "proceedsFromIssuanceOfCommonStock": "None", 401 | "proceedsFromIssuanceOfLongTermDebtAndCapitalSecuritiesNet": "None", 402 | "proceedsFromIssuanceOfPreferredStock": "None", 403 | "proceedsFromRepurchaseOfEquity": "78000000", 404 | "proceedsFromSaleOfTreasuryStock": "None", 405 | "changeInCashAndCashEquivalents": "566000000", 406 | "changeInExchangeRate": "None", 407 | "netIncome": "-702000000" 408 | }, 409 | { 410 | "fiscalDateEnding": "2018-12-31", 411 | "reportedCurrency": "USD", 412 | "operatingCashflow": "1235000000", 413 | "paymentsForOperatingActivities": "None", 414 | "proceedsFromOperatingActivities": "None", 415 | "changeInOperatingLiabilities": "192000000", 416 | "changeInOperatingAssets": "-81000000", 417 | "depreciationDepletionAndAmortization": "538000000", 418 | "capitalExpenditures": "325000000", 419 | "changeInReceivables": "-189000000", 420 | "changeInInventory": "-88000000", 421 | "profitLoss": "210000000", 422 | "cashflowFromInvestment": "-365000000", 423 | "cashflowFromFinancing": "-112000000", 424 | "proceedsFromRepaymentsOfShortTermDebt": "None", 425 | "paymentsForRepurchaseOfCommonStock": "None", 426 | "paymentsForRepurchaseOfEquity": "6000", 427 | "paymentsForRepurchaseOfPreferredStock": "None", 428 | "dividendPayout": "None", 429 | "dividendPayoutCommonStock": "None", 430 | "dividendPayoutPreferredStock": "None", 431 | "proceedsFromIssuanceOfCommonStock": "None", 432 | "proceedsFromIssuanceOfLongTermDebtAndCapitalSecuritiesNet": "None", 433 | "proceedsFromIssuanceOfPreferredStock": "None", 434 | "proceedsFromRepurchaseOfEquity": "76000000", 435 | "proceedsFromSaleOfTreasuryStock": "None", 436 | "changeInCashAndCashEquivalents": "758000000", 437 | "changeInExchangeRate": "None", 438 | "netIncome": "140000000" 439 | }, 440 | { 441 | "fiscalDateEnding": "2018-09-30", 442 | "reportedCurrency": "USD", 443 | "operatingCashflow": "1391040000", 444 | "paymentsForOperatingActivities": "None", 445 | "proceedsFromOperatingActivities": "None", 446 | "changeInOperatingLiabilities": "986859000", 447 | "changeInOperatingAssets": "581295000", 448 | "depreciationDepletionAndAmortization": "300000000", 449 | "capitalExpenditures": "510525000", 450 | "changeInReceivables": "587491000", 451 | "changeInInventory": "55444000", 452 | "profitLoss": "254000000", 453 | "cashflowFromInvestment": "-560546000", 454 | "cashflowFromFinancing": "-84282000", 455 | "proceedsFromRepaymentsOfShortTermDebt": "None", 456 | "paymentsForRepurchaseOfCommonStock": "None", 457 | "paymentsForRepurchaseOfEquity": "None", 458 | "paymentsForRepurchaseOfPreferredStock": "None", 459 | "dividendPayout": "None", 460 | "dividendPayoutCommonStock": "None", 461 | "dividendPayoutPreferredStock": "None", 462 | "proceedsFromIssuanceOfCommonStock": "None", 463 | "proceedsFromIssuanceOfLongTermDebtAndCapitalSecuritiesNet": "None", 464 | "proceedsFromIssuanceOfPreferredStock": "None", 465 | "proceedsFromRepurchaseOfEquity": "94929000", 466 | "proceedsFromSaleOfTreasuryStock": "None", 467 | "changeInCashAndCashEquivalents": "746212000", 468 | "changeInExchangeRate": "None", 469 | "netIncome": "311000000" 470 | }, 471 | { 472 | "fiscalDateEnding": "2018-06-30", 473 | "reportedCurrency": "USD", 474 | "operatingCashflow": "-129664000", 475 | "paymentsForOperatingActivities": "None", 476 | "proceedsFromOperatingActivities": "None", 477 | "changeInOperatingLiabilities": "695923000", 478 | "changeInOperatingAssets": "709898000", 479 | "depreciationDepletionAndAmortization": "251800000", 480 | "capitalExpenditures": "609813000", 481 | "changeInReceivables": "-70633000", 482 | "changeInInventory": "733475000", 483 | "profitLoss": "-742706000", 484 | "cashflowFromInvestment": "-682817000", 485 | "cashflowFromFinancing": "398622000", 486 | "proceedsFromRepaymentsOfShortTermDebt": "None", 487 | "paymentsForRepurchaseOfCommonStock": "None", 488 | "paymentsForRepurchaseOfEquity": "None", 489 | "paymentsForRepurchaseOfPreferredStock": "None", 490 | "dividendPayout": "None", 491 | "dividendPayoutCommonStock": "None", 492 | "dividendPayoutPreferredStock": "None", 493 | "proceedsFromIssuanceOfCommonStock": "None", 494 | "proceedsFromIssuanceOfLongTermDebtAndCapitalSecuritiesNet": "None", 495 | "proceedsFromIssuanceOfPreferredStock": "None", 496 | "proceedsFromRepurchaseOfEquity": "31053000", 497 | "proceedsFromSaleOfTreasuryStock": "None", 498 | "changeInCashAndCashEquivalents": "619000000", 499 | "changeInExchangeRate": "None", 500 | "netIncome": "-718000000" 501 | }, 502 | { 503 | "fiscalDateEnding": "2018-03-31", 504 | "reportedCurrency": "USD", 505 | "operatingCashflow": "-398376000", 506 | "paymentsForOperatingActivities": "None", 507 | "proceedsFromOperatingActivities": "None", 508 | "changeInOperatingLiabilities": "303218000", 509 | "changeInOperatingAssets": "598807000", 510 | "depreciationDepletionAndAmortization": "245200000", 511 | "capitalExpenditures": "655662000", 512 | "changeInReceivables": "169142000", 513 | "changeInInventory": "322081000", 514 | "profitLoss": "-784627000", 515 | "cashflowFromInvestment": "-728637000", 516 | "cashflowFromFinancing": "371660000", 517 | "proceedsFromRepaymentsOfShortTermDebt": "None", 518 | "paymentsForRepurchaseOfCommonStock": "None", 519 | "paymentsForRepurchaseOfEquity": "None", 520 | "paymentsForRepurchaseOfPreferredStock": "None", 521 | "dividendPayout": "None", 522 | "dividendPayoutCommonStock": "None", 523 | "dividendPayoutPreferredStock": "None", 524 | "proceedsFromIssuanceOfCommonStock": "None", 525 | "proceedsFromIssuanceOfLongTermDebtAndCapitalSecuritiesNet": "None", 526 | "proceedsFromIssuanceOfPreferredStock": "None", 527 | "proceedsFromRepurchaseOfEquity": "94018000", 528 | "proceedsFromSaleOfTreasuryStock": "None", 529 | "changeInCashAndCashEquivalents": "456000000", 530 | "changeInExchangeRate": "None", 531 | "netIncome": "-709000000" 532 | }, 533 | { 534 | "fiscalDateEnding": "2017-12-31", 535 | "reportedCurrency": "USD", 536 | "operatingCashflow": "509545000", 537 | "paymentsForOperatingActivities": "None", 538 | "proceedsFromOperatingActivities": "None", 539 | "changeInOperatingLiabilities": "362543000", 540 | "changeInOperatingAssets": "-357445000", 541 | "depreciationDepletionAndAmortization": "235100000", 542 | "capitalExpenditures": "786874000", 543 | "changeInReceivables": "-80643000", 544 | "changeInInventory": "-239970000", 545 | "profitLoss": "-771229000", 546 | "cashflowFromInvestment": "-911642000", 547 | "cashflowFromFinancing": "285978000", 548 | "proceedsFromRepaymentsOfShortTermDebt": "94894000", 549 | "paymentsForRepurchaseOfCommonStock": "None", 550 | "paymentsForRepurchaseOfEquity": "None", 551 | "paymentsForRepurchaseOfPreferredStock": "None", 552 | "dividendPayout": "None", 553 | "dividendPayoutCommonStock": "None", 554 | "dividendPayoutPreferredStock": "None", 555 | "proceedsFromIssuanceOfCommonStock": "None", 556 | "proceedsFromIssuanceOfLongTermDebtAndCapitalSecuritiesNet": "None", 557 | "proceedsFromIssuanceOfPreferredStock": "None", 558 | "proceedsFromRepurchaseOfEquity": "9152000", 559 | "proceedsFromSaleOfTreasuryStock": "None", 560 | "changeInCashAndCashEquivalents": "-162116000", 561 | "changeInExchangeRate": "4027000", 562 | "netIncome": "-675350000" 563 | }, 564 | { 565 | "fiscalDateEnding": "2017-09-30", 566 | "reportedCurrency": "USD", 567 | "operatingCashflow": "-300562000", 568 | "paymentsForOperatingActivities": "None", 569 | "proceedsFromOperatingActivities": "None", 570 | "changeInOperatingLiabilities": "573555000", 571 | "changeInOperatingAssets": "218594000", 572 | "depreciationDepletionAndAmortization": "197500000", 573 | "capitalExpenditures": "1116434000", 574 | "changeInReceivables": "182686000", 575 | "changeInInventory": "25268000", 576 | "profitLoss": "-671163000", 577 | "cashflowFromInvestment": "-1244727000", 578 | "cashflowFromFinancing": "2101506000", 579 | "proceedsFromRepaymentsOfShortTermDebt": "80752000", 580 | "paymentsForRepurchaseOfCommonStock": "None", 581 | "paymentsForRepurchaseOfEquity": "None", 582 | "paymentsForRepurchaseOfPreferredStock": "None", 583 | "dividendPayout": "None", 584 | "dividendPayoutCommonStock": "None", 585 | "dividendPayoutPreferredStock": "None", 586 | "proceedsFromIssuanceOfCommonStock": "None", 587 | "proceedsFromIssuanceOfLongTermDebtAndCapitalSecuritiesNet": "None", 588 | "proceedsFromIssuanceOfPreferredStock": "None", 589 | "proceedsFromRepurchaseOfEquity": "69070000", 590 | "proceedsFromSaleOfTreasuryStock": "None", 591 | "changeInCashAndCashEquivalents": "494106000", 592 | "changeInExchangeRate": "8094000", 593 | "netIncome": "-619376000" 594 | }, 595 | { 596 | "fiscalDateEnding": "2017-06-30", 597 | "reportedCurrency": "USD", 598 | "operatingCashflow": "666615000", 599 | "paymentsForOperatingActivities": "None", 600 | "proceedsFromOperatingActivities": "None", 601 | "changeInOperatingLiabilities": "-6234000", 602 | "changeInOperatingAssets": "321374000", 603 | "depreciationDepletionAndAmortization": "176600000", 604 | "capitalExpenditures": "959068000", 605 | "changeInReceivables": "14498000", 606 | "changeInInventory": "269188000", 607 | "profitLoss": "-401427000", 608 | "cashflowFromInvestment": "-1157912000", 609 | "cashflowFromFinancing": "428767000", 610 | "proceedsFromRepaymentsOfShortTermDebt": "149320000", 611 | "paymentsForRepurchaseOfCommonStock": "None", 612 | "paymentsForRepurchaseOfEquity": "None", 613 | "paymentsForRepurchaseOfPreferredStock": "None", 614 | "dividendPayout": "None", 615 | "dividendPayoutCommonStock": "None", 616 | "dividendPayoutPreferredStock": "None", 617 | "proceedsFromIssuanceOfCommonStock": "None", 618 | "proceedsFromIssuanceOfLongTermDebtAndCapitalSecuritiesNet": "None", 619 | "proceedsFromIssuanceOfPreferredStock": "None", 620 | "proceedsFromRepurchaseOfEquity": "-106587000", 621 | "proceedsFromSaleOfTreasuryStock": "None", 622 | "changeInCashAndCashEquivalents": "-970669000", 623 | "changeInExchangeRate": "15952000", 624 | "netIncome": "-336397000" 625 | }, 626 | { 627 | "fiscalDateEnding": "2017-03-31", 628 | "reportedCurrency": "USD", 629 | "operatingCashflow": "667946000", 630 | "paymentsForOperatingActivities": "None", 631 | "proceedsFromOperatingActivities": "None", 632 | "changeInOperatingLiabilities": "8136000", 633 | "changeInOperatingAssets": "108477000", 634 | "depreciationDepletionAndAmortization": "160100000", 635 | "capitalExpenditures": "552624000", 636 | "changeInReceivables": "-91541000", 637 | "changeInInventory": "124514000", 638 | "profitLoss": "-397181000", 639 | "cashflowFromInvestment": "-881719000", 640 | "cashflowFromFinancing": "1598749000", 641 | "proceedsFromRepaymentsOfShortTermDebt": "186355000", 642 | "paymentsForRepurchaseOfCommonStock": "None", 643 | "paymentsForRepurchaseOfEquity": "None", 644 | "paymentsForRepurchaseOfPreferredStock": "None", 645 | "dividendPayout": "None", 646 | "dividendPayoutCommonStock": "None", 647 | "dividendPayoutPreferredStock": "None", 648 | "proceedsFromIssuanceOfCommonStock": "None", 649 | "proceedsFromIssuanceOfLongTermDebtAndCapitalSecuritiesNet": "None", 650 | "proceedsFromIssuanceOfPreferredStock": "None", 651 | "proceedsFromRepurchaseOfEquity": "510365000", 652 | "proceedsFromSaleOfTreasuryStock": "None", 653 | "changeInCashAndCashEquivalents": "613377000", 654 | "changeInExchangeRate": "11382000", 655 | "netIncome": "-330277000" 656 | }, 657 | { 658 | "fiscalDateEnding": "2016-12-31", 659 | "reportedCurrency": "USD", 660 | "operatingCashflow": "-1208816000", 661 | "paymentsForOperatingActivities": "None", 662 | "proceedsFromOperatingActivities": "None", 663 | "changeInOperatingLiabilities": "114682000", 664 | "changeInOperatingAssets": "371421000", 665 | "depreciationDepletionAndAmortization": "139400000", 666 | "capitalExpenditures": "521612000", 667 | "changeInReceivables": "106055000", 668 | "changeInInventory": "287536000", 669 | "profitLoss": "-219469000", 670 | "cashflowFromInvestment": "-259406000", 671 | "cashflowFromFinancing": "1372827000", 672 | "proceedsFromRepaymentsOfShortTermDebt": "212040000", 673 | "paymentsForRepurchaseOfCommonStock": "None", 674 | "paymentsForRepurchaseOfEquity": "None", 675 | "paymentsForRepurchaseOfPreferredStock": "None", 676 | "dividendPayout": "None", 677 | "dividendPayoutCommonStock": "None", 678 | "dividendPayoutPreferredStock": "None", 679 | "proceedsFromIssuanceOfCommonStock": "None", 680 | "proceedsFromIssuanceOfLongTermDebtAndCapitalSecuritiesNet": "None", 681 | "proceedsFromIssuanceOfPreferredStock": "None", 682 | "proceedsFromRepurchaseOfEquity": "10356000", 683 | "proceedsFromSaleOfTreasuryStock": "None", 684 | "changeInCashAndCashEquivalents": "308959000", 685 | "changeInExchangeRate": "-20908000", 686 | "netIncome": "-121337000" 687 | }, 688 | { 689 | "fiscalDateEnding": "2016-09-30", 690 | "reportedCurrency": "USD", 691 | "operatingCashflow": "696663000", 692 | "paymentsForOperatingActivities": "None", 693 | "proceedsFromOperatingActivities": "None", 694 | "changeInOperatingLiabilities": "474066000", 695 | "changeInOperatingAssets": "439273000", 696 | "depreciationDepletionAndAmortization": "126800000", 697 | "capitalExpenditures": "247611000", 698 | "changeInReceivables": "109084000", 699 | "changeInInventory": "-580283000", 700 | "profitLoss": "21878000", 701 | "cashflowFromInvestment": "-268006000", 702 | "cashflowFromFinancing": "-320870000", 703 | "proceedsFromRepaymentsOfShortTermDebt": "173144000", 704 | "paymentsForRepurchaseOfCommonStock": "None", 705 | "paymentsForRepurchaseOfEquity": "None", 706 | "paymentsForRepurchaseOfPreferredStock": "None", 707 | "dividendPayout": "None", 708 | "dividendPayoutCommonStock": "None", 709 | "dividendPayoutPreferredStock": "None", 710 | "proceedsFromIssuanceOfCommonStock": "None", 711 | "proceedsFromIssuanceOfLongTermDebtAndCapitalSecuritiesNet": "None", 712 | "proceedsFromIssuanceOfPreferredStock": "None", 713 | "proceedsFromRepurchaseOfEquity": "42983000", 714 | "proceedsFromSaleOfTreasuryStock": "None", 715 | "changeInCashAndCashEquivalents": "-162044000", 716 | "changeInExchangeRate": "3183000", 717 | "netIncome": "21878000" 718 | }, 719 | { 720 | "fiscalDateEnding": "2016-06-30", 721 | "reportedCurrency": "USD", 722 | "operatingCashflow": "274776000", 723 | "paymentsForOperatingActivities": "None", 724 | "proceedsFromOperatingActivities": "None", 725 | "changeInOperatingLiabilities": "500253000", 726 | "changeInOperatingAssets": "-186529000", 727 | "depreciationDepletionAndAmortization": "111900000", 728 | "capitalExpenditures": "294720000", 729 | "changeInReceivables": "-157901000", 730 | "changeInInventory": "-705260000", 731 | "profitLoss": "-293188000", 732 | "cashflowFromInvestment": "-319854000", 733 | "cashflowFromFinancing": "1976584000", 734 | "proceedsFromRepaymentsOfShortTermDebt": "142762000", 735 | "paymentsForRepurchaseOfCommonStock": "None", 736 | "paymentsForRepurchaseOfEquity": "None", 737 | "paymentsForRepurchaseOfPreferredStock": "None", 738 | "dividendPayout": "None", 739 | "dividendPayoutCommonStock": "None", 740 | "dividendPayoutPreferredStock": "None", 741 | "proceedsFromIssuanceOfCommonStock": "None", 742 | "proceedsFromIssuanceOfLongTermDebtAndCapitalSecuritiesNet": "None", 743 | "proceedsFromIssuanceOfPreferredStock": "None", 744 | "proceedsFromRepurchaseOfEquity": "1759374000", 745 | "proceedsFromSaleOfTreasuryStock": "None", 746 | "changeInCashAndCashEquivalents": "1804512000", 747 | "changeInExchangeRate": "-2554000", 748 | "netIncome": "-293188000" 749 | }, 750 | { 751 | "fiscalDateEnding": "2016-03-31", 752 | "reportedCurrency": "USD", 753 | "operatingCashflow": "252468000", 754 | "paymentsForOperatingActivities": "None", 755 | "proceedsFromOperatingActivities": "None", 756 | "changeInOperatingLiabilities": "176658000", 757 | "changeInOperatingAssets": "168461000", 758 | "depreciationDepletionAndAmortization": "99200000", 759 | "capitalExpenditures": "216859000", 760 | "changeInReceivables": "159327000", 761 | "changeInInventory": "-512671000", 762 | "profitLoss": "-282267000", 763 | "cashflowFromInvestment": "-233819000", 764 | "cashflowFromFinancing": "715435000", 765 | "proceedsFromRepaymentsOfShortTermDebt": "241763000", 766 | "paymentsForRepurchaseOfCommonStock": "None", 767 | "paymentsForRepurchaseOfEquity": "None", 768 | "paymentsForRepurchaseOfPreferredStock": "None", 769 | "dividendPayout": "None", 770 | "dividendPayoutCommonStock": "None", 771 | "dividendPayoutPreferredStock": "None", 772 | "proceedsFromIssuanceOfCommonStock": "None", 773 | "proceedsFromIssuanceOfLongTermDebtAndCapitalSecuritiesNet": "None", 774 | "proceedsFromIssuanceOfPreferredStock": "None", 775 | "proceedsFromRepurchaseOfEquity": "52838000", 776 | "proceedsFromSaleOfTreasuryStock": "None", 777 | "changeInCashAndCashEquivalents": "244881000", 778 | "changeInExchangeRate": "12870000", 779 | "netIncome": "-282267000" 780 | } 781 | ] 782 | } -------------------------------------------------------------------------------- /spec/fixtures/fundamental/company_overview.json: -------------------------------------------------------------------------------- 1 | { 2 | "Symbol": "TSLA", 3 | "AssetType": "Common Stock", 4 | "Name": "Tesla, Inc", 5 | "Description": "Tesla, Inc. designs, develops, manufactures, leases, and sells electric vehicles, and energy generation and storage systems in the United States, China, and internationally. The company operates in two segments, Automotive, and Energy Generation and Storage. The Automotive segment offers electric vehicles, as well as sells automotive regulatory credits. It provides sedans and sport utility vehicles through direct and used vehicle sales, a network of Tesla Superchargers, and in-app upgrades; and purchase financing and leasing services. This segment is also involved in the provision of non-warranty after-sales vehicle services, sale of used vehicles, retail merchandise, and vehicle insurance, as well as sale of products through its subsidiaries to third party customers; services for electric vehicles through its company-owned service locations, and Tesla mobile service technicians; and vehicle limited warranties and extended service plans. The Energy Generation and Storage segment engages in the design, manufacture, installation, sale, and leasing of solar energy generation and energy storage products, and related services to residential, commercial, and industrial customers and utilities through its website, stores, and galleries, as well as through a network of channel partners. This segment also offers service and repairs to its energy product customers, including under warranty; and various financing options to its solar customers. The company was formerly known as Tesla Motors, Inc. and changed its name to Tesla, Inc. in February 2017. Tesla, Inc. was founded in 2003 and is headquartered in Palo Alto, California.", 6 | "CIK": "1318605", 7 | "Exchange": "NASDAQ", 8 | "Currency": "USD", 9 | "Country": "USA", 10 | "Sector": "Consumer Cyclical", 11 | "Industry": "Auto Manufacturers", 12 | "Address": "3500 Deer Creek Road, Palo Alto, CA, United States, 94304", 13 | "FullTimeEmployees": "70757", 14 | "FiscalYearEnd": "December", 15 | "LatestQuarter": "2020-12-31", 16 | "MarketCapitalization": "723882803200", 17 | "EBITDA": "4272999936", 18 | "PERatio": "1139.6876", 19 | "PEGRatio": "4.5502", 20 | "BookValue": "23.151", 21 | "DividendPerShare": "None", 22 | "DividendYield": "0", 23 | "EPS": "0.64", 24 | "RevenuePerShareTTM": "33.801", 25 | "ProfitMargin": "0.0229", 26 | "OperatingMarginTTM": "0.0619", 27 | "ReturnOnAssetsTTM": "0.0282", 28 | "ReturnOnEquityTTM": "0.0542", 29 | "RevenueTTM": "31536001024", 30 | "GrossProfitTTM": "6630000000", 31 | "DilutedEPSTTM": "0.64", 32 | "QuarterlyEarningsGrowthYOY": "1.055", 33 | "QuarterlyRevenueGrowthYOY": "0.455", 34 | "AnalystTargetPrice": "650.81", 35 | "TrailingPE": "1139.6876", 36 | "ForwardPE": "172.4138", 37 | "PriceToSalesRatioTTM": "25.0488", 38 | "PriceToBookRatio": "31.5013", 39 | "EVToRevenue": "22.455", 40 | "EVToEBITDA": "167.6471", 41 | "Beta": "2.0105", 42 | "52WeekHigh": "895.9", 43 | "52WeekLow": "136.608", 44 | "50DayMovingAverage": "680.1472", 45 | "200DayMovingAverage": "643.4672", 46 | "SharesOutstanding": "959854016", 47 | "SharesFloat": "769936890", 48 | "SharesShort": "46269602", 49 | "SharesShortPriorMonth": "44732793", 50 | "ShortRatio": "1.13", 51 | "ShortPercentOutstanding": "0.05", 52 | "ShortPercentFloat": "0.06", 53 | "PercentInsiders": "19.732", 54 | "PercentInstitutions": "46.013", 55 | "ForwardAnnualDividendRate": "0", 56 | "ForwardAnnualDividendYield": "0", 57 | "PayoutRatio": "0", 58 | "DividendDate": "None", 59 | "ExDividendDate": "None", 60 | "LastSplitFactor": "5:1", 61 | "LastSplitDate": "2020-08-31" 62 | } -------------------------------------------------------------------------------- /spec/fixtures/fundamental/earnings.json: -------------------------------------------------------------------------------- 1 | { 2 | "symbol": "TSLA", 3 | "annualEarnings": [ 4 | { 5 | "fiscalDateEnding": "2021-03-31", 6 | "reportedEPS": "0" 7 | }, 8 | { 9 | "fiscalDateEnding": "2020-12-31", 10 | "reportedEPS": "2.2241" 11 | }, 12 | { 13 | "fiscalDateEnding": "2019-12-31", 14 | "reportedEPS": "-0.0192" 15 | }, 16 | { 17 | "fiscalDateEnding": "2018-12-31", 18 | "reportedEPS": "-0.316" 19 | }, 20 | { 21 | "fiscalDateEnding": "2017-12-31", 22 | "reportedEPS": "-1.724" 23 | }, 24 | { 25 | "fiscalDateEnding": "2016-12-31", 26 | "reportedEPS": "-0.322" 27 | }, 28 | { 29 | "fiscalDateEnding": "2015-12-31", 30 | "reportedEPS": "-0.516" 31 | }, 32 | { 33 | "fiscalDateEnding": "2014-12-31", 34 | "reportedEPS": "0.024" 35 | }, 36 | { 37 | "fiscalDateEnding": "2013-12-31", 38 | "reportedEPS": "0.41" 39 | }, 40 | { 41 | "fiscalDateEnding": "2012-12-31", 42 | "reportedEPS": "-3.22" 43 | }, 44 | { 45 | "fiscalDateEnding": "2011-12-31", 46 | "reportedEPS": "-2.21" 47 | }, 48 | { 49 | "fiscalDateEnding": "2010-12-31", 50 | "reportedEPS": "-0.9212" 51 | } 52 | ], 53 | "quarterlyEarnings": [ 54 | { 55 | "fiscalDateEnding": "2020-12-31", 56 | "reportedDate": "2021-01-27", 57 | "reportedEPS": "0.8", 58 | "estimatedEPS": "1.0514", 59 | "surprise": "-0.2514", 60 | "surprisePercentage": "-23.911" 61 | }, 62 | { 63 | "fiscalDateEnding": "2020-09-30", 64 | "reportedDate": "2020-10-21", 65 | "reportedEPS": "0.76", 66 | "estimatedEPS": "0.6042", 67 | "surprise": "0.1558", 68 | "surprisePercentage": "25.7862" 69 | }, 70 | { 71 | "fiscalDateEnding": "2020-06-30", 72 | "reportedDate": "2020-07-22", 73 | "reportedEPS": "0.436", 74 | "estimatedEPS": "-0.0321", 75 | "surprise": "0.4681", 76 | "surprisePercentage": "1458.2555" 77 | }, 78 | { 79 | "fiscalDateEnding": "2020-03-31", 80 | "reportedDate": "2020-04-29", 81 | "reportedEPS": "0.2281", 82 | "estimatedEPS": "-0.0415", 83 | "surprise": "0.2696", 84 | "surprisePercentage": "649.6386" 85 | }, 86 | { 87 | "fiscalDateEnding": "2019-12-31", 88 | "reportedDate": "2020-01-29", 89 | "reportedEPS": "0.4128", 90 | "estimatedEPS": "0.3506", 91 | "surprise": "0.0622", 92 | "surprisePercentage": "17.741" 93 | }, 94 | { 95 | "fiscalDateEnding": "2019-09-30", 96 | "reportedDate": "2019-10-23", 97 | "reportedEPS": "0.372", 98 | "estimatedEPS": "-0.0463", 99 | "surprise": "0.4183", 100 | "surprisePercentage": "903.4557" 101 | }, 102 | { 103 | "fiscalDateEnding": "2019-06-30", 104 | "reportedDate": "2019-07-24", 105 | "reportedEPS": "-0.224", 106 | "estimatedEPS": "-0.0794", 107 | "surprise": "-0.1446", 108 | "surprisePercentage": "-182.1159" 109 | }, 110 | { 111 | "fiscalDateEnding": "2019-03-31", 112 | "reportedDate": "2019-04-24", 113 | "reportedEPS": "-0.58", 114 | "estimatedEPS": "-0.1873", 115 | "surprise": "-0.3927", 116 | "surprisePercentage": "-209.6636" 117 | }, 118 | { 119 | "fiscalDateEnding": "2018-12-31", 120 | "reportedDate": "2019-01-30", 121 | "reportedEPS": "0.386", 122 | "estimatedEPS": "0.4035", 123 | "surprise": "-0.0175", 124 | "surprisePercentage": "-4.3371" 125 | }, 126 | { 127 | "fiscalDateEnding": "2018-09-30", 128 | "reportedDate": "2018-10-24", 129 | "reportedEPS": "0.58", 130 | "estimatedEPS": "-0.0181", 131 | "surprise": "0.5981", 132 | "surprisePercentage": "3304.4199" 133 | }, 134 | { 135 | "fiscalDateEnding": "2018-06-30", 136 | "reportedDate": "2018-08-01", 137 | "reportedEPS": "-0.612", 138 | "estimatedEPS": "-0.5639", 139 | "surprise": "-0.0481", 140 | "surprisePercentage": "-8.5299" 141 | }, 142 | { 143 | "fiscalDateEnding": "2018-03-31", 144 | "reportedDate": "2018-05-02", 145 | "reportedEPS": "-0.67", 146 | "estimatedEPS": "-0.7051", 147 | "surprise": "0.0351", 148 | "surprisePercentage": "4.978" 149 | }, 150 | { 151 | "fiscalDateEnding": "2017-12-31", 152 | "reportedDate": "2018-02-07", 153 | "reportedEPS": "-0.608", 154 | "estimatedEPS": "-0.6297", 155 | "surprise": "0.0217", 156 | "surprisePercentage": "3.4461" 157 | }, 158 | { 159 | "fiscalDateEnding": "2017-09-30", 160 | "reportedDate": "2017-11-01", 161 | "reportedEPS": "-0.584", 162 | "estimatedEPS": "-0.458", 163 | "surprise": "-0.126", 164 | "surprisePercentage": "-27.5109" 165 | }, 166 | { 167 | "fiscalDateEnding": "2017-06-30", 168 | "reportedDate": "2017-08-02", 169 | "reportedEPS": "-0.266", 170 | "estimatedEPS": "-0.3837", 171 | "surprise": "0.1177", 172 | "surprisePercentage": "30.675" 173 | }, 174 | { 175 | "fiscalDateEnding": "2017-03-31", 176 | "reportedDate": "2017-05-03", 177 | "reportedEPS": "-0.266", 178 | "estimatedEPS": "-0.1603", 179 | "surprise": "-0.1057", 180 | "surprisePercentage": "-65.9389" 181 | }, 182 | { 183 | "fiscalDateEnding": "2016-12-31", 184 | "reportedDate": "2017-02-22", 185 | "reportedEPS": "-0.138", 186 | "estimatedEPS": "-0.0981", 187 | "surprise": "-0.0399", 188 | "surprisePercentage": "-40.6728" 189 | }, 190 | { 191 | "fiscalDateEnding": "2016-09-30", 192 | "reportedDate": "2016-10-26", 193 | "reportedEPS": "0.142", 194 | "estimatedEPS": "0.0045", 195 | "surprise": "0.1375", 196 | "surprisePercentage": "3055.5556" 197 | }, 198 | { 199 | "fiscalDateEnding": "2016-06-30", 200 | "reportedDate": "2016-08-03", 201 | "reportedEPS": "-0.212", 202 | "estimatedEPS": "-0.1246", 203 | "surprise": "-0.0874", 204 | "surprisePercentage": "-70.1445" 205 | }, 206 | { 207 | "fiscalDateEnding": "2016-03-31", 208 | "reportedDate": "2016-05-04", 209 | "reportedEPS": "-0.114", 210 | "estimatedEPS": "-0.1344", 211 | "surprise": "0.0204", 212 | "surprisePercentage": "15.1786" 213 | }, 214 | { 215 | "fiscalDateEnding": "2015-12-31", 216 | "reportedDate": "2016-02-10", 217 | "reportedEPS": "-0.174", 218 | "estimatedEPS": "0.0219", 219 | "surprise": "-0.1959", 220 | "surprisePercentage": "-894.5205" 221 | }, 222 | { 223 | "fiscalDateEnding": "2015-09-30", 224 | "reportedDate": "2015-11-03", 225 | "reportedEPS": "-0.174", 226 | "estimatedEPS": "-0.1", 227 | "surprise": "-0.074", 228 | "surprisePercentage": "-74" 229 | }, 230 | { 231 | "fiscalDateEnding": "2015-06-30", 232 | "reportedDate": "2015-08-05", 233 | "reportedEPS": "-0.096", 234 | "estimatedEPS": "-0.12", 235 | "surprise": "0.024", 236 | "surprisePercentage": "20" 237 | }, 238 | { 239 | "fiscalDateEnding": "2015-03-31", 240 | "reportedDate": "2015-05-06", 241 | "reportedEPS": "-0.072", 242 | "estimatedEPS": "-0.1", 243 | "surprise": "0.028", 244 | "surprisePercentage": "28" 245 | }, 246 | { 247 | "fiscalDateEnding": "2014-12-31", 248 | "reportedDate": "2015-02-11", 249 | "reportedEPS": "-0.026", 250 | "estimatedEPS": "0.062", 251 | "surprise": "-0.088", 252 | "surprisePercentage": "-141.9355" 253 | }, 254 | { 255 | "fiscalDateEnding": "2014-09-30", 256 | "reportedDate": "2014-11-05", 257 | "reportedEPS": "0.004", 258 | "estimatedEPS": "-0.002", 259 | "surprise": "0.006", 260 | "surprisePercentage": "300" 261 | }, 262 | { 263 | "fiscalDateEnding": "2014-06-30", 264 | "reportedDate": "2014-07-31", 265 | "reportedEPS": "0.022", 266 | "estimatedEPS": "0.008", 267 | "surprise": "0.014", 268 | "surprisePercentage": "175" 269 | }, 270 | { 271 | "fiscalDateEnding": "2014-03-31", 272 | "reportedDate": "2014-05-07", 273 | "reportedEPS": "0.024", 274 | "estimatedEPS": "0.02", 275 | "surprise": "0.004", 276 | "surprisePercentage": "20" 277 | }, 278 | { 279 | "fiscalDateEnding": "2013-12-31", 280 | "reportedDate": "2014-02-19", 281 | "reportedEPS": "0.066", 282 | "estimatedEPS": "0.042", 283 | "surprise": "0.024", 284 | "surprisePercentage": "57.1429" 285 | }, 286 | { 287 | "fiscalDateEnding": "2013-09-30", 288 | "reportedDate": "2013-11-05", 289 | "reportedEPS": "0.024", 290 | "estimatedEPS": "0.022", 291 | "surprise": "0.002", 292 | "surprisePercentage": "9.0909" 293 | }, 294 | { 295 | "fiscalDateEnding": "2013-06-30", 296 | "reportedDate": "2013-08-07", 297 | "reportedEPS": "0.2", 298 | "estimatedEPS": "-0.17", 299 | "surprise": "0.37", 300 | "surprisePercentage": "217.6471" 301 | }, 302 | { 303 | "fiscalDateEnding": "2013-03-31", 304 | "reportedDate": "2013-05-08", 305 | "reportedEPS": "0.12", 306 | "estimatedEPS": "0.04", 307 | "surprise": "0.08", 308 | "surprisePercentage": "200" 309 | }, 310 | { 311 | "fiscalDateEnding": "2012-12-31", 312 | "reportedDate": "2013-02-20", 313 | "reportedEPS": "-0.65", 314 | "estimatedEPS": "-0.53", 315 | "surprise": "-0.12", 316 | "surprisePercentage": "-22.6415" 317 | }, 318 | { 319 | "fiscalDateEnding": "2012-09-30", 320 | "reportedDate": "2012-11-05", 321 | "reportedEPS": "-0.92", 322 | "estimatedEPS": "-0.9", 323 | "surprise": "-0.02", 324 | "surprisePercentage": "-2.2222" 325 | }, 326 | { 327 | "fiscalDateEnding": "2012-06-30", 328 | "reportedDate": "2012-07-25", 329 | "reportedEPS": "-0.89", 330 | "estimatedEPS": "-0.92", 331 | "surprise": "0.03", 332 | "surprisePercentage": "3.2609" 333 | }, 334 | { 335 | "fiscalDateEnding": "2012-03-31", 336 | "reportedDate": "2012-05-09", 337 | "reportedEPS": "-0.76", 338 | "estimatedEPS": "-0.69", 339 | "surprise": "-0.07", 340 | "surprisePercentage": "-10.1449" 341 | }, 342 | { 343 | "fiscalDateEnding": "2011-12-31", 344 | "reportedDate": "2012-02-15", 345 | "reportedEPS": "-0.69", 346 | "estimatedEPS": "-0.63", 347 | "surprise": "-0.06", 348 | "surprisePercentage": "-9.5238" 349 | }, 350 | { 351 | "fiscalDateEnding": "2011-09-30", 352 | "reportedDate": "2011-11-02", 353 | "reportedEPS": "-0.55", 354 | "estimatedEPS": "-0.59", 355 | "surprise": "0.04", 356 | "surprisePercentage": "6.7797" 357 | }, 358 | { 359 | "fiscalDateEnding": "2011-06-30", 360 | "reportedDate": "2011-08-03", 361 | "reportedEPS": "-0.53", 362 | "estimatedEPS": "-0.51", 363 | "surprise": "-0.02", 364 | "surprisePercentage": "-3.9216" 365 | }, 366 | { 367 | "fiscalDateEnding": "2011-03-31", 368 | "reportedDate": "2011-05-04", 369 | "reportedEPS": "-0.44", 370 | "estimatedEPS": "-0.51", 371 | "surprise": "0.07", 372 | "surprisePercentage": "13.7255" 373 | }, 374 | { 375 | "fiscalDateEnding": "2010-12-31", 376 | "reportedDate": "2011-02-15", 377 | "reportedEPS": "-0.47", 378 | "estimatedEPS": "-0.5", 379 | "surprise": "0.03", 380 | "surprisePercentage": "6" 381 | }, 382 | { 383 | "fiscalDateEnding": "2010-09-30", 384 | "reportedDate": "2010-11-09", 385 | "reportedEPS": "-0.37", 386 | "estimatedEPS": "-0.43", 387 | "surprise": "0.06", 388 | "surprisePercentage": "13.9535" 389 | }, 390 | { 391 | "fiscalDateEnding": "2010-06-30", 392 | "reportedDate": "2010-08-05", 393 | "reportedEPS": "-0.0812", 394 | "estimatedEPS": "None", 395 | "surprise": "None", 396 | "surprisePercentage": "None" 397 | } 398 | ] 399 | } -------------------------------------------------------------------------------- /spec/fixtures/fundamental/income_statement.json: -------------------------------------------------------------------------------- 1 | { 2 | "symbol": "TSLA", 3 | "annualReports": [ 4 | { 5 | "fiscalDateEnding": "2020-12-31", 6 | "reportedCurrency": "USD", 7 | "grossProfit": "6630000000", 8 | "totalRevenue": "31536000000", 9 | "costOfRevenue": "24906000000", 10 | "costofGoodsAndServicesSold": "289000000", 11 | "operatingIncome": "1994000000", 12 | "sellingGeneralAndAdministrative": "3145000000", 13 | "researchAndDevelopment": "1491000000", 14 | "operatingExpenses": "4636000000", 15 | "investmentIncomeNet": "30000000", 16 | "netInterestIncome": "-748000000", 17 | "interestIncome": "0", 18 | "interestExpense": "748000000", 19 | "nonInterestIncome": "-336000000", 20 | "otherNonOperatingIncome": "-122000000", 21 | "depreciation": "1570000000", 22 | "depreciationAndAmortization": "399000000", 23 | "incomeBeforeTax": "1013000000", 24 | "incomeTaxExpense": "292000000", 25 | "interestAndDebtExpense": "853000000", 26 | "netIncomeFromContinuingOperations": "862000000", 27 | "comprehensiveIncomeNetOfTax": "1120000000", 28 | "ebit": "1994000000", 29 | "ebitda": "2393000000", 30 | "netIncome": "721000000" 31 | }, 32 | { 33 | "fiscalDateEnding": "2019-12-31", 34 | "reportedCurrency": "USD", 35 | "grossProfit": "4069000000", 36 | "totalRevenue": "24578000000", 37 | "costOfRevenue": "20509000000", 38 | "costofGoodsAndServicesSold": "193000000", 39 | "operatingIncome": "-69000000", 40 | "sellingGeneralAndAdministrative": "2646000000", 41 | "researchAndDevelopment": "1343000000", 42 | "operatingExpenses": "4138000000", 43 | "investmentIncomeNet": "44000000", 44 | "netInterestIncome": "-685000000", 45 | "interestIncome": "0", 46 | "interestExpense": "685000000", 47 | "nonInterestIncome": "-98000000", 48 | "otherNonOperatingIncome": "45000000", 49 | "depreciation": "1370000000", 50 | "depreciationAndAmortization": "343000000", 51 | "incomeBeforeTax": "-752000000", 52 | "incomeTaxExpense": "110000000", 53 | "interestAndDebtExpense": "685000000", 54 | "netIncomeFromContinuingOperations": "-775000000", 55 | "comprehensiveIncomeNetOfTax": "-890000000", 56 | "ebit": "-69000000", 57 | "ebitda": "274000000", 58 | "netIncome": "-862000000" 59 | }, 60 | { 61 | "fiscalDateEnding": "2018-12-31", 62 | "reportedCurrency": "USD", 63 | "grossProfit": "4042000000", 64 | "totalRevenue": "21461000000", 65 | "costOfRevenue": "17418526000", 66 | "costofGoodsAndServicesSold": "85000000", 67 | "operatingIncome": "-388366000", 68 | "sellingGeneralAndAdministrative": "2835163000", 69 | "researchAndDevelopment": "1460225000", 70 | "operatingExpenses": "4430822000", 71 | "investmentIncomeNet": "24000000", 72 | "netInterestIncome": "-663000000", 73 | "interestIncome": "128000", 74 | "interestExpense": "663128000", 75 | "nonInterestIncome": "-160000000", 76 | "otherNonOperatingIncome": "22195000", 77 | "depreciation": "1110000000", 78 | "depreciationAndAmortization": "66000000", 79 | "incomeBeforeTax": "-917688000", 80 | "incomeTaxExpense": "58312000", 81 | "interestAndDebtExpense": "663000000", 82 | "netIncomeFromContinuingOperations": "-1063000000", 83 | "comprehensiveIncomeNetOfTax": "-1017893000", 84 | "ebit": "-388366000", 85 | "ebitda": "-322366000", 86 | "netIncome": "-976000000" 87 | }, 88 | { 89 | "fiscalDateEnding": "2017-12-31", 90 | "reportedCurrency": "USD", 91 | "grossProfit": "2222487000", 92 | "totalRevenue": "11758751000", 93 | "costOfRevenue": "9536000000", 94 | "costofGoodsAndServicesSold": "132000000", 95 | "operatingIncome": "-1632000000", 96 | "sellingGeneralAndAdministrative": "2477000000", 97 | "researchAndDevelopment": "1378000000", 98 | "operatingExpenses": "3855000000", 99 | "investmentIncomeNet": "19000000", 100 | "netInterestIncome": "-471000000", 101 | "interestIncome": "0", 102 | "interestExpense": "471000000", 103 | "nonInterestIncome": "-158000000", 104 | "otherNonOperatingIncome": "-125000000", 105 | "depreciation": "769000000", 106 | "depreciationAndAmortization": "1636003000", 107 | "incomeBeforeTax": "-1929400000", 108 | "incomeTaxExpense": "32000000", 109 | "interestAndDebtExpense": "471000000", 110 | "netIncomeFromContinuingOperations": "-2241000000", 111 | "comprehensiveIncomeNetOfTax": "-1905000000", 112 | "ebit": "-1632000000", 113 | "ebitda": "4003000", 114 | "netIncome": "-1961400000" 115 | }, 116 | { 117 | "fiscalDateEnding": "2016-12-31", 118 | "reportedCurrency": "USD", 119 | "grossProfit": "1599257000", 120 | "totalRevenue": "7000132000", 121 | "costOfRevenue": "5400875000", 122 | "costofGoodsAndServicesSold": "65520000", 123 | "operatingIncome": "-667340000", 124 | "sellingGeneralAndAdministrative": "1432189000", 125 | "researchAndDevelopment": "834408000", 126 | "operatingExpenses": "2266597000", 127 | "investmentIncomeNet": "8530000", 128 | "netInterestIncome": "-198810000", 129 | "interestIncome": "0", 130 | "interestExpense": "198810000", 131 | "nonInterestIncome": "756309000", 132 | "otherNonOperatingIncome": "111272000", 133 | "depreciation": "477300000", 134 | "depreciationAndAmortization": "947099000", 135 | "incomeBeforeTax": "-648216000", 136 | "incomeTaxExpense": "26698000", 137 | "interestAndDebtExpense": "198810000", 138 | "netIncomeFromContinuingOperations": "-773046000", 139 | "comprehensiveIncomeNetOfTax": "-695098000", 140 | "ebit": "-667340000", 141 | "ebitda": "279759000", 142 | "netIncome": "-674914000" 143 | } 144 | ], 145 | "quarterlyReports": [ 146 | { 147 | "fiscalDateEnding": "2020-12-31", 148 | "reportedCurrency": "USD", 149 | "grossProfit": "2066000000", 150 | "totalRevenue": "10744000000", 151 | "costOfRevenue": "8678000000", 152 | "costofGoodsAndServicesSold": "149000000", 153 | "operatingIncome": "575000000", 154 | "sellingGeneralAndAdministrative": "969000000", 155 | "researchAndDevelopment": "522000000", 156 | "operatingExpenses": "1491000000", 157 | "investmentIncomeNet": "6000000", 158 | "netInterestIncome": "-246000000", 159 | "interestIncome": "0", 160 | "interestExpense": "246000000", 161 | "nonInterestIncome": "-125000000", 162 | "otherNonOperatingIncome": "44000000", 163 | "depreciation": "440000000", 164 | "depreciationAndAmortization": "618000000", 165 | "incomeBeforeTax": "353000000", 166 | "incomeTaxExpense": "83000000", 167 | "interestAndDebtExpense": "351000000", 168 | "netIncomeFromContinuingOperations": "296000000", 169 | "comprehensiveIncomeNetOfTax": "508000000", 170 | "ebit": "575000000", 171 | "ebitda": "1193000000", 172 | "netIncome": "270000000" 173 | }, 174 | { 175 | "fiscalDateEnding": "2020-09-30", 176 | "reportedCurrency": "USD", 177 | "grossProfit": "2063000000", 178 | "totalRevenue": "8771000000", 179 | "costOfRevenue": "6708000000", 180 | "costofGoodsAndServicesSold": "52000000", 181 | "operatingIncome": "809000000", 182 | "sellingGeneralAndAdministrative": "888000000", 183 | "researchAndDevelopment": "366000000", 184 | "operatingExpenses": "1254000000", 185 | "investmentIncomeNet": "6000000", 186 | "netInterestIncome": "-163000000", 187 | "interestIncome": "0", 188 | "interestExpense": "163000000", 189 | "nonInterestIncome": "-161000000", 190 | "otherNonOperatingIncome": "-97000000", 191 | "depreciation": "403000000", 192 | "depreciationAndAmortization": "584000000", 193 | "incomeBeforeTax": "517000000", 194 | "incomeTaxExpense": "186000000", 195 | "interestAndDebtExpense": "163000000", 196 | "netIncomeFromContinuingOperations": "369000000", 197 | "comprehensiveIncomeNetOfTax": "496000000", 198 | "ebit": "809000000", 199 | "ebitda": "1393000000", 200 | "netIncome": "331000000" 201 | }, 202 | { 203 | "fiscalDateEnding": "2020-06-30", 204 | "reportedCurrency": "USD", 205 | "grossProfit": "1267000000", 206 | "totalRevenue": "6036000000", 207 | "costOfRevenue": "4769000000", 208 | "costofGoodsAndServicesSold": "43000000", 209 | "operatingIncome": "327000000", 210 | "sellingGeneralAndAdministrative": "661000000", 211 | "researchAndDevelopment": "279000000", 212 | "operatingExpenses": "940000000", 213 | "investmentIncomeNet": "8000000", 214 | "netInterestIncome": "-170000000", 215 | "interestIncome": "0", 216 | "interestExpense": "170000000", 217 | "nonInterestIncome": "-24000000", 218 | "otherNonOperatingIncome": "-15000000", 219 | "depreciation": "356000000", 220 | "depreciationAndAmortization": "567000000", 221 | "incomeBeforeTax": "125000000", 222 | "incomeTaxExpense": "21000000", 223 | "interestAndDebtExpense": "170000000", 224 | "netIncomeFromContinuingOperations": "1267000000", 225 | "comprehensiveIncomeNetOfTax": "177000000", 226 | "ebit": "327000000", 227 | "ebitda": "894000000", 228 | "netIncome": "104000000" 229 | }, 230 | { 231 | "fiscalDateEnding": "2020-03-31", 232 | "reportedCurrency": "USD", 233 | "grossProfit": "1234000000", 234 | "totalRevenue": "5985000000", 235 | "costOfRevenue": "4751000000", 236 | "costofGoodsAndServicesSold": "45000000", 237 | "operatingIncome": "283000000", 238 | "sellingGeneralAndAdministrative": "627000000", 239 | "researchAndDevelopment": "324000000", 240 | "operatingExpenses": "951000000", 241 | "investmentIncomeNet": "10000000", 242 | "netInterestIncome": "-169000000", 243 | "interestIncome": "0", 244 | "interestExpense": "169000000", 245 | "nonInterestIncome": "-26000000", 246 | "otherNonOperatingIncome": "-54000000", 247 | "depreciation": "371000000", 248 | "depreciationAndAmortization": "553000000", 249 | "incomeBeforeTax": "18000000", 250 | "incomeTaxExpense": "2000000", 251 | "interestAndDebtExpense": "169000000", 252 | "netIncomeFromContinuingOperations": "1234000000", 253 | "comprehensiveIncomeNetOfTax": "-61000000", 254 | "ebit": "283000000", 255 | "ebitda": "836000000", 256 | "netIncome": "16000000" 257 | }, 258 | { 259 | "fiscalDateEnding": "2019-12-31", 260 | "reportedCurrency": "USD", 261 | "grossProfit": "1391000000", 262 | "totalRevenue": "7384000000", 263 | "costOfRevenue": "5993000000", 264 | "costofGoodsAndServicesSold": "26000000", 265 | "operatingIncome": "359000000", 266 | "sellingGeneralAndAdministrative": "699000000", 267 | "researchAndDevelopment": "345000000", 268 | "operatingExpenses": "1032000000", 269 | "investmentIncomeNet": "10000000", 270 | "netInterestIncome": "-170000000", 271 | "interestIncome": "0", 272 | "interestExpense": "170000000", 273 | "nonInterestIncome": "-131000000", 274 | "otherNonOperatingIncome": "-25000000", 275 | "depreciation": "383000000", 276 | "depreciationAndAmortization": "577000000", 277 | "incomeBeforeTax": "147000000", 278 | "incomeTaxExpense": "42000000", 279 | "interestAndDebtExpense": "170000000", 280 | "netIncomeFromContinuingOperations": "132000000", 281 | "comprehensiveIncomeNetOfTax": "189000000", 282 | "ebit": "359000000", 283 | "ebitda": "924000000", 284 | "netIncome": "105000000" 285 | }, 286 | { 287 | "fiscalDateEnding": "2019-09-30", 288 | "reportedCurrency": "USD", 289 | "grossProfit": "1191000000", 290 | "totalRevenue": "6303000000", 291 | "costOfRevenue": "5112000000", 292 | "costofGoodsAndServicesSold": "51000000", 293 | "operatingIncome": "261000000", 294 | "sellingGeneralAndAdministrative": "596000000", 295 | "researchAndDevelopment": "334000000", 296 | "operatingExpenses": "930000000", 297 | "investmentIncomeNet": "15000000", 298 | "netInterestIncome": "-185000000", 299 | "interestIncome": "0", 300 | "interestExpense": "185000000", 301 | "nonInterestIncome": "70000000", 302 | "otherNonOperatingIncome": "85000000", 303 | "depreciation": "353000000", 304 | "depreciationAndAmortization": "530851000", 305 | "incomeBeforeTax": "169000000", 306 | "incomeTaxExpense": "26000000", 307 | "interestAndDebtExpense": "185000000", 308 | "netIncomeFromContinuingOperations": "150000000", 309 | "comprehensiveIncomeNetOfTax": "29000000", 310 | "ebit": "261000000", 311 | "ebitda": "791851000", 312 | "netIncome": "143000000" 313 | }, 314 | { 315 | "fiscalDateEnding": "2019-06-30", 316 | "reportedCurrency": "USD", 317 | "grossProfit": "921000000", 318 | "totalRevenue": "6350000000", 319 | "costOfRevenue": "5429000000", 320 | "costofGoodsAndServicesSold": "35000000", 321 | "operatingIncome": "-167000000", 322 | "sellingGeneralAndAdministrative": "647000000", 323 | "researchAndDevelopment": "324000000", 324 | "operatingExpenses": "1088000000", 325 | "investmentIncomeNet": "10000000", 326 | "netInterestIncome": "-172000000", 327 | "interestIncome": "0", 328 | "interestExpense": "172000000", 329 | "nonInterestIncome": "208362000", 330 | "otherNonOperatingIncome": "-41000000", 331 | "depreciation": "335000000", 332 | "depreciationAndAmortization": "578572000", 333 | "incomeBeforeTax": "-389000000", 334 | "incomeTaxExpense": "19000000", 335 | "interestAndDebtExpense": "172000000", 336 | "netIncomeFromContinuingOperations": "921000000", 337 | "comprehensiveIncomeNetOfTax": "-379000000", 338 | "ebit": "-167000000", 339 | "ebitda": "528459000", 340 | "netIncome": "-408000000" 341 | }, 342 | { 343 | "fiscalDateEnding": "2019-03-31", 344 | "reportedCurrency": "USD", 345 | "grossProfit": "566000000", 346 | "totalRevenue": "4541000000", 347 | "costOfRevenue": "3975000000", 348 | "costofGoodsAndServicesSold": "81000000", 349 | "operatingIncome": "-522000000", 350 | "sellingGeneralAndAdministrative": "704000000", 351 | "researchAndDevelopment": "340000000", 352 | "operatingExpenses": "1088000000", 353 | "investmentIncomeNet": "9000000", 354 | "netInterestIncome": "-158000000", 355 | "interestIncome": "0", 356 | "interestExpense": "158000000", 357 | "nonInterestIncome": "21000000", 358 | "otherNonOperatingIncome": "26000000", 359 | "depreciation": "299000000", 360 | "depreciationAndAmortization": "467577000", 361 | "incomeBeforeTax": "-679000000", 362 | "incomeTaxExpense": "23000000", 363 | "interestAndDebtExpense": "158000000", 364 | "netIncomeFromContinuingOperations": "566000000", 365 | "comprehensiveIncomeNetOfTax": "-729000000", 366 | "ebit": "-522000000", 367 | "ebitda": "-10783000", 368 | "netIncome": "-702000000" 369 | }, 370 | { 371 | "fiscalDateEnding": "2018-12-31", 372 | "reportedCurrency": "USD", 373 | "grossProfit": "1443000000", 374 | "totalRevenue": "7226000000", 375 | "costOfRevenue": "5783000000", 376 | "costofGoodsAndServicesSold": "25000000", 377 | "operatingIncome": "414000000", 378 | "sellingGeneralAndAdministrative": "668000000", 379 | "researchAndDevelopment": "356000000", 380 | "operatingExpenses": "1029000000", 381 | "investmentIncomeNet": "7000000", 382 | "netInterestIncome": "-175000000", 383 | "interestIncome": "0", 384 | "interestExpense": "175000000", 385 | "nonInterestIncome": "-34000000", 386 | "otherNonOperatingIncome": "-14000000", 387 | "depreciation": "313000000", 388 | "depreciationAndAmortization": "496737000", 389 | "incomeBeforeTax": "162000000", 390 | "incomeTaxExpense": "22000000", 391 | "interestAndDebtExpense": "175000000", 392 | "netIncomeFromContinuingOperations": "210000000", 393 | "comprehensiveIncomeNetOfTax": "123000000", 394 | "ebit": "414000000", 395 | "ebitda": "915888000", 396 | "netIncome": "140000000" 397 | }, 398 | { 399 | "fiscalDateEnding": "2018-09-30", 400 | "reportedCurrency": "USD", 401 | "grossProfit": "1524000000", 402 | "totalRevenue": "6824000000", 403 | "costOfRevenue": "5300000000", 404 | "costofGoodsAndServicesSold": "13902000", 405 | "operatingIncome": "416000000", 406 | "sellingGeneralAndAdministrative": "730000000", 407 | "researchAndDevelopment": "351000000", 408 | "operatingExpenses": "1108000000", 409 | "investmentIncomeNet": "6722000", 410 | "netInterestIncome": "-174872000", 411 | "interestIncome": "128000", 412 | "interestExpense": "175000000", 413 | "nonInterestIncome": "-414217000", 414 | "otherNonOperatingIncome": "23000000", 415 | "depreciation": "300000000", 416 | "depreciationAndAmortization": "502825000", 417 | "incomeBeforeTax": "328000000", 418 | "incomeTaxExpense": "17000000", 419 | "interestAndDebtExpense": "174872000", 420 | "netIncomeFromContinuingOperations": "254333000", 421 | "comprehensiveIncomeNetOfTax": "301000000", 422 | "ebit": "416000000", 423 | "ebitda": "945766000", 424 | "netIncome": "311000000" 425 | }, 426 | { 427 | "fiscalDateEnding": "2018-06-30", 428 | "reportedCurrency": "USD", 429 | "grossProfit": "619000000", 430 | "totalRevenue": "4002000000", 431 | "costOfRevenue": "3383301000", 432 | "costofGoodsAndServicesSold": "2860012000", 433 | "operatingIncome": "-621392000", 434 | "sellingGeneralAndAdministrative": "750759000", 435 | "researchAndDevelopment": "386129000", 436 | "operatingExpenses": "1240322000", 437 | "investmentIncomeNet": "5064000", 438 | "netInterestIncome": "-163582000", 439 | "interestIncome": "0", 440 | "interestExpense": "163582000", 441 | "nonInterestIncome": "239816000", 442 | "otherNonOperatingIncome": "50911000", 443 | "depreciation": "251800000", 444 | "depreciationAndAmortization": "485255000", 445 | "incomeBeforeTax": "-704293000", 446 | "incomeTaxExpense": "13707000", 447 | "interestAndDebtExpense": "163582000", 448 | "netIncomeFromContinuingOperations": "619000000", 449 | "comprehensiveIncomeNetOfTax": "-781915000", 450 | "ebit": "-621392000", 451 | "ebitda": "-32703000", 452 | "netIncome": "-718000000" 453 | }, 454 | { 455 | "fiscalDateEnding": "2018-03-31", 456 | "reportedCurrency": "USD", 457 | "grossProfit": "456000000", 458 | "totalRevenue": "3409000000", 459 | "costOfRevenue": "2952225000", 460 | "costofGoodsAndServicesSold": "18546000", 461 | "operatingIncome": "-596974000", 462 | "sellingGeneralAndAdministrative": "686404000", 463 | "researchAndDevelopment": "367096000", 464 | "operatingExpenses": "1053500000", 465 | "investmentIncomeNet": "5214000", 466 | "netInterestIncome": "-149546000", 467 | "interestIncome": "0", 468 | "interestExpense": "149546000", 469 | "nonInterestIncome": "73538000", 470 | "otherNonOperatingIncome": "-37716000", 471 | "depreciation": "245200000", 472 | "depreciationAndAmortization": "416233000", 473 | "incomeBeforeTax": "-703395000", 474 | "incomeTaxExpense": "5605000", 475 | "interestAndDebtExpense": "149546000", 476 | "netIncomeFromContinuingOperations": "456000000", 477 | "comprehensiveIncomeNetOfTax": "-659978000", 478 | "ebit": "-596974000", 479 | "ebitda": "-180741000", 480 | "netIncome": "-709000000" 481 | }, 482 | { 483 | "fiscalDateEnding": "2017-12-31", 484 | "reportedCurrency": "USD", 485 | "grossProfit": "438786000", 486 | "totalRevenue": "3288249000", 487 | "costOfRevenue": "2849199000", 488 | "costofGoodsAndServicesSold": "33653000", 489 | "operatingIncome": "-598055000", 490 | "sellingGeneralAndAdministrative": "682790000", 491 | "researchAndDevelopment": "354564000", 492 | "operatingExpenses": "1037354000", 493 | "investmentIncomeNet": "5594000", 494 | "netInterestIncome": "-146104000", 495 | "interestIncome": "0", 496 | "interestExpense": "146104000", 497 | "nonInterestIncome": "-875889000", 498 | "otherNonOperatingIncome": "-41304000", 499 | "depreciation": "None", 500 | "depreciationAndAmortization": "469606000", 501 | "incomeBeforeTax": "-683990000", 502 | "incomeTaxExpense": "-8640000", 503 | "interestAndDebtExpense": "146104000", 504 | "netIncomeFromContinuingOperations": "-771229000", 505 | "comprehensiveIncomeNetOfTax": "-663940000", 506 | "ebit": "-598055000", 507 | "ebitda": "-128535000", 508 | "netIncome": "-675350000" 509 | }, 510 | { 511 | "fiscalDateEnding": "2017-09-30", 512 | "reportedCurrency": "USD", 513 | "grossProfit": "449140000", 514 | "totalRevenue": "2984675000", 515 | "costOfRevenue": "2535535000", 516 | "costofGoodsAndServicesSold": "-3297670000", 517 | "operatingIncome": "-535480000", 518 | "sellingGeneralAndAdministrative": "652998000", 519 | "researchAndDevelopment": "331622000", 520 | "operatingExpenses": "984620000", 521 | "investmentIncomeNet": "5531000", 522 | "netInterestIncome": "-117109000", 523 | "interestIncome": "0", 524 | "interestExpense": "117109000", 525 | "nonInterestIncome": "273551000", 526 | "otherNonOperatingIncome": "-24390000", 527 | "depreciation": "None", 528 | "depreciationAndAmortization": "400624000", 529 | "incomeBeforeTax": "-619661000", 530 | "incomeTaxExpense": "-285000", 531 | "interestAndDebtExpense": "117109000", 532 | "netIncomeFromContinuingOperations": "-671163000", 533 | "comprehensiveIncomeNetOfTax": "-609087000", 534 | "ebit": "-535480000", 535 | "ebitda": "-134856000", 536 | "netIncome": "-619376000" 537 | }, 538 | { 539 | "fiscalDateEnding": "2017-06-30", 540 | "reportedCurrency": "USD", 541 | "grossProfit": "666615000", 542 | "totalRevenue": "2789557000", 543 | "costOfRevenue": "2122942000", 544 | "costofGoodsAndServicesSold": "1676340000", 545 | "operatingIncome": "-240916000", 546 | "sellingGeneralAndAdministrative": "537757000", 547 | "researchAndDevelopment": "369774000", 548 | "operatingExpenses": "907531000", 549 | "investmentIncomeNet": "4785000", 550 | "netInterestIncome": "-108441000", 551 | "interestIncome": "0", 552 | "interestExpense": "108441000", 553 | "nonInterestIncome": "272764000", 554 | "otherNonOperatingIncome": "-41208000", 555 | "depreciation": "None", 556 | "depreciationAndAmortization": "389171000", 557 | "incomeBeforeTax": "-320750000", 558 | "incomeTaxExpense": "15647000", 559 | "interestAndDebtExpense": "108441000", 560 | "netIncomeFromContinuingOperations": "666615000", 561 | "comprehensiveIncomeNetOfTax": "-304667000", 562 | "ebit": "-240916000", 563 | "ebitda": "148255000", 564 | "netIncome": "-336397000" 565 | }, 566 | { 567 | "fiscalDateEnding": "2017-03-31", 568 | "reportedCurrency": "USD", 569 | "grossProfit": "667946000", 570 | "totalRevenue": "2696270000", 571 | "costOfRevenue": "2028324000", 572 | "costofGoodsAndServicesSold": "1675340000", 573 | "operatingIncome": "-257549000", 574 | "sellingGeneralAndAdministrative": "603455000", 575 | "researchAndDevelopment": "322040000", 576 | "operatingExpenses": "925495000", 577 | "investmentIncomeNet": "3090000", 578 | "netInterestIncome": "-99346000", 579 | "interestIncome": "0", 580 | "interestExpense": "99346000", 581 | "nonInterestIncome": "208356000", 582 | "otherNonOperatingIncome": "-18098000", 583 | "depreciation": "None", 584 | "depreciationAndAmortization": "376602000", 585 | "incomeBeforeTax": "-304999000", 586 | "incomeTaxExpense": "25278000", 587 | "interestAndDebtExpense": "99346000", 588 | "netIncomeFromContinuingOperations": "667946000", 589 | "comprehensiveIncomeNetOfTax": "-327306000", 590 | "ebit": "-257549000", 591 | "ebitda": "119053000", 592 | "netIncome": "-330277000" 593 | }, 594 | { 595 | "fiscalDateEnding": "2016-12-31", 596 | "reportedCurrency": "USD", 597 | "grossProfit": "435278000", 598 | "totalRevenue": "2284631000", 599 | "costOfRevenue": "1849353000", 600 | "costofGoodsAndServicesSold": "-2930805000", 601 | "operatingIncome": "-266698000", 602 | "sellingGeneralAndAdministrative": "456016000", 603 | "researchAndDevelopment": "245960000", 604 | "operatingExpenses": "701976000", 605 | "investmentIncomeNet": "2179000", 606 | "netInterestIncome": "-65104000", 607 | "interestIncome": "0", 608 | "interestExpense": "65104000", 609 | "nonInterestIncome": "271827000", 610 | "otherNonOperatingIncome": "121224000", 611 | "depreciation": "None", 612 | "depreciationAndAmortization": "326939000", 613 | "incomeBeforeTax": "-110267000", 614 | "incomeTaxExpense": "11070000", 615 | "interestAndDebtExpense": "65104000", 616 | "netIncomeFromContinuingOperations": "-219469000", 617 | "comprehensiveIncomeNetOfTax": "-170387000", 618 | "ebit": "-266698000", 619 | "ebitda": "60241000", 620 | "netIncome": "-121337000" 621 | }, 622 | { 623 | "fiscalDateEnding": "2016-09-30", 624 | "reportedCurrency": "USD", 625 | "grossProfit": "636735000", 626 | "totalRevenue": "2298436000", 627 | "costOfRevenue": "1661701000", 628 | "costofGoodsAndServicesSold": "1399948000", 629 | "operatingIncome": "85622000", 630 | "sellingGeneralAndAdministrative": "336811000", 631 | "researchAndDevelopment": "214302000", 632 | "operatingExpenses": "551113000", 633 | "investmentIncomeNet": "2858000", 634 | "netInterestIncome": "-46713000", 635 | "interestIncome": "0", 636 | "interestExpense": "46713000", 637 | "nonInterestIncome": "212164000", 638 | "otherNonOperatingIncome": "-11756000", 639 | "depreciation": "None", 640 | "depreciationAndAmortization": "280468000", 641 | "incomeBeforeTax": "30011000", 642 | "incomeTaxExpense": "8133000", 643 | "interestAndDebtExpense": "46713000", 644 | "netIncomeFromContinuingOperations": "21878000", 645 | "comprehensiveIncomeNetOfTax": "12995000", 646 | "ebit": "85622000", 647 | "ebitda": "366090000", 648 | "netIncome": "21878000" 649 | }, 650 | { 651 | "fiscalDateEnding": "2016-06-30", 652 | "reportedCurrency": "USD", 653 | "grossProfit": "274776000", 654 | "totalRevenue": "1270017000", 655 | "costOfRevenue": "995241000", 656 | "costofGoodsAndServicesSold": "835390000", 657 | "operatingIncome": "-238040000", 658 | "sellingGeneralAndAdministrative": "321152000", 659 | "researchAndDevelopment": "191664000", 660 | "operatingExpenses": "512816000", 661 | "investmentIncomeNet": "2242000", 662 | "netInterestIncome": "-46368000", 663 | "interestIncome": "0", 664 | "interestExpense": "46368000", 665 | "nonInterestIncome": "151628000", 666 | "otherNonOperatingIncome": "-7373000", 667 | "depreciation": "None", 668 | "depreciationAndAmortization": "183232000", 669 | "incomeBeforeTax": "-289539000", 670 | "incomeTaxExpense": "3649000", 671 | "interestAndDebtExpense": "46368000", 672 | "netIncomeFromContinuingOperations": "274776000", 673 | "comprehensiveIncomeNetOfTax": "-272560000", 674 | "ebit": "-238040000", 675 | "ebitda": "-54808000", 676 | "netIncome": "-293188000" 677 | }, 678 | { 679 | "fiscalDateEnding": "2016-03-31", 680 | "reportedCurrency": "USD", 681 | "grossProfit": "252468000", 682 | "totalRevenue": "1147048000", 683 | "costOfRevenue": "894580000", 684 | "costofGoodsAndServicesSold": "744272000", 685 | "operatingIncome": "-248224000", 686 | "sellingGeneralAndAdministrative": "318210000", 687 | "researchAndDevelopment": "182482000", 688 | "operatingExpenses": "500692000", 689 | "investmentIncomeNet": "1251000", 690 | "netInterestIncome": "-40625000", 691 | "interestIncome": "0", 692 | "interestExpense": "40625000", 693 | "nonInterestIncome": "107357000", 694 | "otherNonOperatingIncome": "9177000", 695 | "depreciation": "None", 696 | "depreciationAndAmortization": "156460000", 697 | "incomeBeforeTax": "-278421000", 698 | "incomeTaxExpense": "3846000", 699 | "interestAndDebtExpense": "40625000", 700 | "netIncomeFromContinuingOperations": "252468000", 701 | "comprehensiveIncomeNetOfTax": "-265146000", 702 | "ebit": "-248224000", 703 | "ebitda": "-91764000", 704 | "netIncome": "-282267000" 705 | } 706 | ] 707 | } -------------------------------------------------------------------------------- /spec/fixtures/indicator/bop.json: -------------------------------------------------------------------------------- 1 | { 2 | "Meta Data": { 3 | "1: Symbol": "IBM", 4 | "2: Indicator": "Balance Of Power (BOP)", 5 | "3: Last Refreshed": "2021-04-30", 6 | "4: Interval": "daily", 7 | "5: Time Zone": "US/Eastern Time" 8 | }, 9 | "Technical Analysis: BOP": { 10 | "2021-04-30": { 11 | "BOP": "-0.5549" 12 | }, 13 | "2021-04-29": { 14 | "BOP": "0.0191" 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /spec/fixtures/indicator/ema.json: -------------------------------------------------------------------------------- 1 | { 2 | "Meta Data": { 3 | "1: Symbol": "TSLA", 4 | "2: Indicator": "Exponential Moving Average (EMA)", 5 | "3: Last Refreshed": "2021-04-23", 6 | "4: Interval": "weekly", 7 | "5: Time Period": 10, 8 | "6: Series Type": "open", 9 | "7: Time Zone": "US/Eastern" 10 | }, 11 | "Technical Analysis: EMA": { 12 | "2021-04-23": { 13 | "EMA": "699.3560" 14 | }, 15 | "2021-04-16": { 16 | "EMA": "694.8574" 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /spec/fixtures/indicator/macd.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "Meta Data": { 4 | "1: Symbol": "IBM", 5 | "2: Indicator": "Moving Average Convergence/Divergence (MACD)", 6 | "3: Last Refreshed": "2021-04-30", 7 | "4: Interval": "daily", 8 | "5.1: Fast Period": 12, 9 | "5.2: Slow Period": 26, 10 | "5.3: Signal Period": 9, 11 | "6: Series Type": "open", 12 | "7: Time Zone": "US/Eastern" 13 | }, 14 | "Technical Analysis: MACD": { 15 | "2021-04-30": { 16 | "MACD": "3.5648", 17 | "MACD_Signal": "3.0571", 18 | "MACD_Hist": "0.5077" 19 | }, 20 | "2021-04-29": { 21 | "MACD": "3.5100", 22 | "MACD_Signal": "2.9302", 23 | "MACD_Hist": "0.5798" 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /spec/fixtures/indicator/sma.json: -------------------------------------------------------------------------------- 1 | { 2 | "Meta Data": { 3 | "1: Symbol": "TSLA", 4 | "2: Indicator": "Simple Moving Average (SMA)", 5 | "3: Last Refreshed": "2021-04-23", 6 | "4: Interval": "weekly", 7 | "5: Time Period": 10, 8 | "6: Series Type": "open", 9 | "7: Time Zone": "US/Eastern" 10 | }, 11 | "Technical Analysis: SMA": { 12 | "2021-04-23": { 13 | "SMA": "697.8630" 14 | }, 15 | "2021-04-16": { 16 | "SMA": "712.8700" 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /spec/fixtures/indicator/stoch.json: -------------------------------------------------------------------------------- 1 | { 2 | "Meta Data": { 3 | "1: Symbol": "IBM", 4 | "2: Indicator": "Stochastic (STOCH)", 5 | "3: Last Refreshed": "2021-04-30", 6 | "4: Interval": "daily", 7 | "5.1: FastK Period": 5, 8 | "5.2: SlowK Period": 3, 9 | "5.3: SlowK MA Type": 0, 10 | "5.4: SlowD Period": 3, 11 | "5.5: SlowD MA Type": 0, 12 | "6: Time Zone": "US/Eastern Time" 13 | }, 14 | "Technical Analysis: STOCH": { 15 | "2021-04-30": { 16 | "SlowK": "38.7700", 17 | "SlowD": "50.6307" 18 | }, 19 | "2021-04-29": { 20 | "SlowK": "53.7457", 21 | "SlowD": "60.2343" 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /spec/fixtures/indicator/vwap.json: -------------------------------------------------------------------------------- 1 | { 2 | "Meta Data": { 3 | "1: Symbol": "IBM", 4 | "2: Indicator": "Volume Weighted Average Price (VWAP)", 5 | "3: Last Refreshed": "2021-04-30 20:00:00", 6 | "4: Interval": "15min", 7 | "5: Time Zone": "US/Eastern" 8 | }, 9 | "Technical Analysis: VWAP": { 10 | "2021-04-30 20:00": { 11 | "VWAP": "141.5264" 12 | }, 13 | "2021-04-30 19:45": { 14 | "VWAP": "141.5264" 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /spec/fixtures/time_series/daily.json: -------------------------------------------------------------------------------- 1 | { 2 | "Meta Data": { 3 | "1. Information": "Daily Prices (open, high, low, close) and Volumes", 4 | "2. Symbol": "TSLA", 5 | "3. Last Refreshed": "2021-04-23", 6 | "4. Output Size": "Compact", 7 | "5. Time Zone": "US/Eastern" 8 | }, 9 | "Time Series (Daily)": { 10 | "2021-04-23": { 11 | "1. open": "719.8000", 12 | "2. high": "737.3600", 13 | "3. low": "715.4600", 14 | "4. close": "729.4000", 15 | "5. volume": "27703323" 16 | }, 17 | "2021-04-22": { 18 | "1. open": "741.5000", 19 | "2. high": "753.7700", 20 | "3. low": "718.0400", 21 | "4. close": "719.6900", 22 | "5. volume": "35590255" 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /spec/fixtures/time_series/daily_adjusted.json: -------------------------------------------------------------------------------- 1 | { 2 | "Meta Data": { 3 | "1. Information": "Daily Time Series with Splits and Dividend Events", 4 | "2. Symbol": "TSLA", 5 | "3. Last Refreshed": "2021-04-23", 6 | "4. Output Size": "Compact", 7 | "5. Time Zone": "US/Eastern" 8 | }, 9 | "Time Series (Daily)": { 10 | "2021-04-23": { 11 | "1. open": "719.8", 12 | "2. high": "737.36", 13 | "3. low": "715.46", 14 | "4. close": "729.4", 15 | "5. adjusted close": "729.4", 16 | "6. volume": "27703323", 17 | "7. dividend amount": "0.0000", 18 | "8. split coefficient": "1.0" 19 | }, 20 | "2021-04-22": { 21 | "1. open": "741.5", 22 | "2. high": "753.77", 23 | "3. low": "718.04", 24 | "4. close": "719.69", 25 | "5. adjusted close": "719.69", 26 | "6. volume": "35590255", 27 | "7. dividend amount": "0.0000", 28 | "8. split coefficient": "1.0" 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /spec/fixtures/time_series/intraday.csv: -------------------------------------------------------------------------------- 1 | timestamp,open,high,low,close,volume 2 | 2021-05-13 20:00:00,574.4700,575.0000,573.5000,573.5000,11050 3 | 2021-05-13 19:55:00,574.5000,574.7500,574.0000,574.4500,5949 4 | 2021-05-13 19:50:00,574.4500,575.0000,574.4500,574.5000,6267 5 | 2021-05-13 19:45:00,573.5900,574.0100,573.1000,574.0100,2610 6 | 2021-05-13 19:40:00,573.1500,573.4000,573.0000,573.1000,10917 7 | 2021-05-13 19:35:00,574.2500,574.2500,573.4000,573.4000,1676 8 | 2021-05-13 19:30:00,574.0000,574.2300,574.0000,574.1000,1747 9 | 2021-05-13 19:25:00,573.9800,574.1300,573.9800,574.0000,4100 10 | 2021-05-13 19:20:00,573.5200,574.0000,573.5200,574.0000,1596 11 | 2021-05-13 19:15:00,572.0200,573.5000,571.6200,573.5000,5658 12 | 2021-05-13 19:10:00,573.2000,573.2000,573.2000,573.2000,319 13 | 2021-05-13 19:05:00,573.3200,573.3200,573.1000,573.1000,1063 14 | 2021-05-13 19:00:00,574.0700,574.4800,573.7500,573.7500,2763 15 | 2021-05-13 18:55:00,574.0000,574.3400,574.0000,574.0700,3010 16 | 2021-05-13 18:50:00,573.5300,574.0000,573.5300,574.0000,1098 17 | 2021-05-13 18:45:00,573.1100,573.5000,573.1100,573.4500,2056 18 | 2021-05-13 18:40:00,573.0000,573.0000,572.0000,572.2600,3390 19 | 2021-05-13 18:35:00,574.0000,574.0000,573.5000,573.5000,2609 20 | 2021-05-13 18:30:00,573.7500,573.7500,573.5700,573.5700,608 21 | 2021-05-13 18:25:00,573.7500,573.7500,573.0000,573.4800,3649 22 | 2021-05-13 18:20:00,573.2500,574.5000,573.0200,573.7500,2891 23 | 2021-05-13 18:15:00,574.7300,574.7400,574.0000,574.0000,2728 24 | 2021-05-13 18:10:00,574.9800,575.1500,574.1100,574.1101,5779 25 | 2021-05-13 18:05:00,574.9800,575.6000,574.7500,575.4000,5665 26 | 2021-05-13 18:00:00,573.8000,574.7500,573.8000,574.1500,9566 27 | 2021-05-13 17:55:00,573.9900,574.2500,573.5700,574.2000,4179 28 | 2021-05-13 17:50:00,573.7000,574.5000,573.0600,574.1800,9302 29 | 2021-05-13 17:45:00,572.3000,573.8800,571.5000,573.8800,8578 30 | 2021-05-13 17:40:00,571.7500,572.3000,571.7500,572.3000,2993 31 | 2021-05-13 17:35:00,570.1200,572.5500,570.1200,572.5000,4489 32 | 2021-05-13 17:30:00,571.5000,571.5000,570.7500,571.0000,2650 33 | 2021-05-13 17:25:00,570.4800,571.0000,570.4800,571.0000,7426 34 | 2021-05-13 17:20:00,570.0600,570.7500,570.0600,570.7500,1213 35 | 2021-05-13 17:15:00,570.5000,571.6900,570.5000,570.5000,20358 36 | 2021-05-13 17:10:00,570.7500,570.7500,570.0000,570.4300,2910 37 | 2021-05-13 17:05:00,569.6500,570.3100,569.5000,570.3100,1952 38 | 2021-05-13 17:00:00,570.6800,570.8000,569.5500,569.5900,9843 39 | 2021-05-13 16:55:00,570.7200,570.7500,570.0100,570.2600,5349 40 | 2021-05-13 16:50:00,571.2000,571.3000,570.6000,570.7200,7110 41 | 2021-05-13 16:45:00,570.8500,571.3194,570.0300,571.2000,10712 42 | 2021-05-13 16:40:00,569.4500,570.7500,569.1000,570.7500,5270 43 | 2021-05-13 16:35:00,569.0600,569.5000,569.0000,569.1500,6241 44 | 2021-05-13 16:30:00,569.0000,569.3300,568.5100,569.2000,7069 45 | 2021-05-13 16:25:00,569.0900,569.0900,568.2700,569.0000,4634 46 | 2021-05-13 16:20:00,568.2000,569.3300,568.0100,569.3300,13604 47 | 2021-05-13 16:15:00,568.0000,568.5000,568.0000,568.2000,9306 48 | 2021-05-13 16:10:00,570.5000,580.0340,567.9900,568.0000,36437 49 | 2021-05-13 16:05:00,571.6900,572.0000,570.2500,570.2500,132795 50 | 2021-05-13 16:00:00,571.7500,573.3000,571.0000,571.4000,748695 51 | 2021-05-13 15:55:00,572.6000,572.7600,570.8900,571.7100,444070 52 | 2021-05-13 15:50:00,574.1500,574.3420,571.8900,572.4200,354344 53 | 2021-05-13 15:45:00,573.5860,574.3000,572.4100,574.0339,368046 54 | 2021-05-13 15:40:00,571.6400,574.0000,571.3200,573.6000,363120 55 | 2021-05-13 15:35:00,568.9800,573.3476,568.9800,571.7400,405571 56 | 2021-05-13 15:30:00,567.2700,569.4600,567.0101,569.1250,316736 57 | 2021-05-13 15:25:00,566.4400,567.8445,565.4000,567.1400,306431 58 | 2021-05-13 15:20:00,568.7800,569.1200,566.0710,566.3000,302032 59 | 2021-05-13 15:15:00,573.9000,574.0500,567.2900,568.5300,450424 60 | 2021-05-13 15:10:00,571.1233,575.0290,571.1233,573.8271,351067 61 | 2021-05-13 15:05:00,571.0201,573.2500,570.6800,571.0100,295927 62 | 2021-05-13 15:00:00,574.7700,574.7700,570.5001,570.9744,340711 63 | 2021-05-13 14:55:00,575.7399,576.7669,573.1601,574.6000,425685 64 | 2021-05-13 14:50:00,575.6500,576.0000,572.7400,575.6575,361076 65 | 2021-05-13 14:45:00,575.5000,576.5700,574.8600,575.7750,323531 66 | 2021-05-13 14:40:00,572.2000,577.0000,571.4101,575.4866,636000 67 | 2021-05-13 14:35:00,571.9100,573.0000,569.7001,572.1800,315814 68 | 2021-05-13 14:30:00,572.0300,573.0000,570.2900,572.0099,325792 69 | 2021-05-13 14:25:00,569.5900,574.5700,569.5700,572.0951,445743 70 | 2021-05-13 14:20:00,572.5050,572.8300,569.1100,569.5800,415772 71 | 2021-05-13 14:15:00,571.5500,573.5000,571.1900,572.2075,381226 72 | 2021-05-13 14:10:00,568.8600,573.9899,568.2800,571.6140,578275 73 | 2021-05-13 14:05:00,563.8700,569.5000,563.6700,568.8736,617301 74 | 2021-05-13 14:00:00,564.6000,565.4700,562.8400,563.9200,393490 75 | 2021-05-13 13:55:00,561.4700,565.4800,561.4700,564.5100,561430 76 | 2021-05-13 13:50:00,563.6750,564.0040,560.6343,561.2950,380492 77 | 2021-05-13 13:45:00,562.6500,563.8900,560.8800,563.7590,455356 78 | 2021-05-13 13:40:00,562.0000,563.1700,559.6500,562.5050,774784 79 | 2021-05-13 13:35:00,565.6600,566.7000,561.7900,562.0155,744580 80 | 2021-05-13 13:30:00,567.0000,568.0541,565.6501,565.6600,495379 81 | 2021-05-13 13:25:00,570.4150,571.3300,566.4200,566.9200,641693 82 | 2021-05-13 13:20:00,573.3500,574.6199,570.1400,570.5399,359907 83 | 2021-05-13 13:15:00,572.5000,574.5000,568.9400,573.3095,460760 84 | 2021-05-13 13:10:00,573.3500,573.8490,570.5100,572.8600,398915 85 | 2021-05-13 13:05:00,571.0200,573.5000,569.7100,573.2600,485814 86 | 2021-05-13 13:00:00,573.3801,573.5599,570.5100,570.9700,420933 87 | 2021-05-13 12:55:00,576.9300,577.3000,572.3500,573.3464,372363 88 | 2021-05-13 12:50:00,574.7700,577.0450,574.3601,576.8200,274045 89 | 2021-05-13 12:45:00,576.8800,577.3100,573.7300,574.6200,336994 90 | 2021-05-13 12:40:00,578.5050,579.5600,576.1501,576.5742,282522 91 | 2021-05-13 12:35:00,575.8235,579.8300,575.8235,578.4200,448583 92 | 2021-05-13 12:30:00,574.1500,576.2099,573.3800,575.7999,273588 93 | 2021-05-13 12:25:00,576.6960,577.9800,573.8538,574.1500,386753 94 | 2021-05-13 12:20:00,575.9600,578.0000,575.9600,576.6100,356897 95 | 2021-05-13 12:15:00,573.6937,577.4894,573.6900,576.0000,589712 96 | 2021-05-13 12:10:00,570.7300,574.0000,570.5000,573.7200,404609 97 | 2021-05-13 12:05:00,569.7390,572.5600,568.8100,570.6300,601906 98 | 2021-05-13 12:00:00,574.0000,574.8900,567.9700,569.6000,853875 99 | 2021-05-13 11:55:00,573.3500,575.7800,572.2794,573.9800,498442 100 | 2021-05-13 11:50:00,571.9000,574.2300,570.5700,573.4653,678307 101 | 2021-05-13 11:45:00,578.5000,578.6399,571.2010,571.8900,701441 102 | -------------------------------------------------------------------------------- /spec/fixtures/time_series/intraday.json: -------------------------------------------------------------------------------- 1 | { 2 | "Meta Data": { 3 | "1. Information": "Intraday (5min) open, high, low, close prices and volume", 4 | "2. Symbol": "TSLA", 5 | "3. Last Refreshed": "2021-04-23 20:00:00", 6 | "4. Interval": "5min", 7 | "5. Output Size": "Compact", 8 | "6. Time Zone": "US/Eastern" 9 | }, 10 | "Time Series (5min)": { 11 | "2021-04-23 20:00:00": { 12 | "1. open": "730.2500", 13 | "2. high": "730.5000", 14 | "3. low": "730.1000", 15 | "4. close": "730.1000", 16 | "5. volume": "5637" 17 | }, 18 | "2021-04-23 19:55:00": { 19 | "1. open": "730.1100", 20 | "2. high": "730.7000", 21 | "3. low": "730.1100", 22 | "4. close": "730.2800", 23 | "5. volume": "3283" 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /spec/fixtures/time_series/intraday_extended_history.csv: -------------------------------------------------------------------------------- 1 | time,open,high,low,close,volume 2 | 2021-05-13 20:00:00,574.47,575.0,573.5,573.5,11050 3 | 2021-05-13 19:55:00,574.5,574.75,574.0,574.45,5949 4 | 2021-05-13 19:50:00,574.45,575.0,574.45,574.5,6267 5 | 2021-05-13 19:45:00,573.59,574.01,573.1,574.01,2610 6 | 2021-05-13 19:40:00,573.15,573.4,573.0,573.1,10917 7 | 2021-05-13 19:35:00,574.25,574.25,573.4,573.4,1676 8 | 2021-05-13 19:30:00,574.0,574.23,574.0,574.1,1747 9 | 2021-05-13 19:25:00,573.98,574.13,573.98,574.0,4100 10 | 2021-05-13 19:20:00,573.52,574.0,573.52,574.0,1596 11 | 2021-05-13 19:15:00,572.02,573.5,571.62,573.5,5658 12 | 2021-05-13 19:10:00,573.2,573.2,573.2,573.2,319 13 | 2021-05-13 19:05:00,573.32,573.32,573.1,573.1,1063 14 | 2021-05-13 19:00:00,574.07,574.48,573.75,573.75,2763 15 | 2021-05-13 18:55:00,574.0,574.34,574.0,574.07,3010 16 | 2021-05-13 18:50:00,573.53,574.0,573.53,574.0,1098 17 | 2021-05-13 18:45:00,573.11,573.5,573.11,573.45,2056 18 | 2021-05-13 18:40:00,573.0,573.0,572.0,572.26,3390 19 | 2021-05-13 18:35:00,574.0,574.0,573.5,573.5,2609 20 | 2021-05-13 18:30:00,573.75,573.75,573.57,573.57,608 21 | 2021-05-13 18:25:00,573.75,573.75,573.0,573.48,3649 22 | 2021-05-13 18:20:00,573.25,574.5,573.02,573.75,2891 23 | 2021-05-13 18:15:00,574.73,574.74,574.0,574.0,2728 24 | 2021-05-13 18:10:00,574.98,575.15,574.11,574.1101,5779 25 | 2021-05-13 18:05:00,574.98,575.6,574.75,575.4,5665 26 | 2021-05-13 18:00:00,573.8,574.75,573.8,574.15,9566 27 | 2021-05-13 17:55:00,573.99,574.25,573.57,574.2,4179 28 | 2021-05-13 17:50:00,573.7,574.5,573.06,574.18,9302 29 | 2021-05-13 17:45:00,572.3,573.88,571.5,573.88,8578 30 | 2021-05-13 17:40:00,571.75,572.3,571.75,572.3,2993 31 | 2021-05-13 17:35:00,570.12,572.55,570.12,572.5,4489 32 | 2021-05-13 17:30:00,571.5,571.5,570.75,571.0,2650 33 | 2021-05-13 17:25:00,570.48,571.0,570.48,571.0,7426 34 | 2021-05-13 17:20:00,570.06,570.75,570.06,570.75,1213 35 | 2021-05-13 17:15:00,570.5,571.69,570.5,570.5,20358 36 | 2021-05-13 17:10:00,570.75,570.75,570.0,570.43,2910 37 | 2021-05-13 17:05:00,569.65,570.31,569.5,570.31,1952 38 | 2021-05-13 17:00:00,570.68,570.8,569.55,569.59,9843 39 | 2021-05-13 16:55:00,570.72,570.75,570.01,570.26,5349 40 | 2021-05-13 16:50:00,571.2,571.3,570.6,570.72,7110 41 | 2021-05-13 16:45:00,570.85,571.3194,570.03,571.2,10712 42 | 2021-05-13 16:40:00,569.45,570.75,569.1,570.75,5270 43 | 2021-05-13 16:35:00,569.06,569.5,569.0,569.15,6241 44 | 2021-05-13 16:30:00,569.0,569.33,568.51,569.2,7069 45 | 2021-05-13 16:25:00,569.09,569.09,568.27,569.0,4634 46 | 2021-05-13 16:20:00,568.2,569.33,568.01,569.33,13604 47 | 2021-05-13 16:15:00,568.0,568.5,568.0,568.2,9306 48 | 2021-05-13 16:10:00,570.5,580.034,567.99,568.0,36437 49 | 2021-05-13 16:05:00,571.69,572.0,570.25,570.25,132795 50 | 2021-05-13 16:00:00,571.75,573.3,571.0,571.4,748695 51 | 2021-05-13 15:55:00,572.6,572.76,570.89,571.71,444070 52 | 2021-05-13 15:50:00,574.15,574.342,571.89,572.42,354344 53 | 2021-05-13 15:45:00,573.586,574.3,572.41,574.0339,368046 54 | 2021-05-13 15:40:00,571.64,574.0,571.32,573.6,363120 55 | 2021-05-13 15:35:00,568.98,573.3476,568.98,571.74,405571 56 | 2021-05-13 15:30:00,567.27,569.46,567.0101,569.125,316736 57 | 2021-05-13 15:25:00,566.44,567.8445,565.4,567.14,306431 58 | 2021-05-13 15:20:00,568.78,569.12,566.071,566.3,302032 59 | 2021-05-13 15:15:00,573.9,574.05,567.29,568.53,450424 60 | 2021-05-13 15:10:00,571.1233,575.029,571.1233,573.8271,351067 61 | 2021-05-13 15:05:00,571.0201,573.25,570.68,571.01,295927 62 | 2021-05-13 15:00:00,574.77,574.77,570.5001,570.9744,340711 63 | 2021-05-13 14:55:00,575.7399,576.7669,573.1601,574.6,425685 64 | 2021-05-13 14:50:00,575.65,576.0,572.74,575.6575,361076 65 | 2021-05-13 14:45:00,575.5,576.57,574.86,575.775,323531 66 | 2021-05-13 14:40:00,572.2,577.0,571.4101,575.4866,636000 67 | 2021-05-13 14:35:00,571.91,573.0,569.7001,572.18,315814 68 | 2021-05-13 14:30:00,572.03,573.0,570.29,572.0099,325792 69 | 2021-05-13 14:25:00,569.59,574.57,569.57,572.0951,445743 70 | 2021-05-13 14:20:00,572.505,572.83,569.11,569.58,415772 71 | 2021-05-13 14:15:00,571.55,573.5,571.19,572.2075,381226 72 | 2021-05-13 14:10:00,568.86,573.9899,568.28,571.614,578275 73 | 2021-05-13 14:05:00,563.87,569.5,563.67,568.8736,617301 74 | 2021-05-13 14:00:00,564.6,565.47,562.84,563.92,393490 75 | 2021-05-13 13:55:00,561.47,565.48,561.47,564.51,561430 76 | 2021-05-13 13:50:00,563.675,564.004,560.6343,561.295,380492 77 | 2021-05-13 13:45:00,562.65,563.89,560.88,563.759,455356 78 | 2021-05-13 13:40:00,562.0,563.17,559.65,562.505,774784 79 | 2021-05-13 13:35:00,565.66,566.7,561.79,562.0155,744580 80 | 2021-05-13 13:30:00,567.0,568.0541,565.6501,565.66,495379 81 | 2021-05-13 13:25:00,570.415,571.33,566.42,566.92,641693 82 | 2021-05-13 13:20:00,573.35,574.6199,570.14,570.5399,359907 83 | 2021-05-13 13:15:00,572.5,574.5,568.94,573.3095,460760 84 | 2021-05-13 13:10:00,573.35,573.849,570.51,572.86,398915 85 | 2021-05-13 13:05:00,571.02,573.5,569.71,573.26,485814 86 | 2021-05-13 13:00:00,573.3801,573.5599,570.51,570.97,420933 87 | 2021-05-13 12:55:00,576.93,577.3,572.35,573.3464,372363 88 | 2021-05-13 12:50:00,574.77,577.045,574.3601,576.82,274045 89 | 2021-05-13 12:45:00,576.88,577.31,573.73,574.62,336994 90 | 2021-05-13 12:40:00,578.505,579.56,576.1501,576.5742,282522 91 | 2021-05-13 12:35:00,575.8235,579.83,575.8235,578.42,448583 92 | 2021-05-13 12:30:00,574.15,576.2099,573.38,575.7999,273588 93 | 2021-05-13 12:25:00,576.696,577.98,573.8538,574.15,386753 94 | 2021-05-13 12:20:00,575.96,578.0,575.96,576.61,356897 95 | 2021-05-13 12:15:00,573.6937,577.4894,573.69,576.0,589712 96 | 2021-05-13 12:10:00,570.73,574.0,570.5,573.72,404609 97 | 2021-05-13 12:05:00,569.739,572.56,568.81,570.63,601906 98 | 2021-05-13 12:00:00,574.0,574.89,567.97,569.6,853875 99 | 2021-05-13 11:55:00,573.35,575.78,572.2794,573.98,498442 100 | 2021-05-13 11:50:00,571.9,574.23,570.57,573.4653,678307 101 | 2021-05-13 11:45:00,578.5,578.6399,571.201,571.89,701441 102 | 2021-05-13 11:40:00,577.41,578.99,576.28,578.66,481195 103 | 2021-05-13 11:35:00,573.7,577.65,573.7,577.41,686997 104 | 2021-05-13 11:30:00,577.26,578.28,572.7,574.27,1036289 105 | 2021-05-13 11:25:00,580.64,581.58,576.3816,577.26,747719 106 | 2021-05-13 11:20:00,580.78,581.63,579.11,580.8,754899 107 | 2021-05-13 11:15:00,582.08,583.4057,580.18,580.94,544658 108 | 2021-05-13 11:10:00,583.18,583.45,581.21,581.998,665799 109 | 2021-05-13 11:05:00,589.045,589.25,582.76,583.011,585303 110 | 2021-05-13 11:00:00,590.945,591.875,588.28,588.84,484017 111 | 2021-05-13 10:55:00,584.9,591.4,584.44,590.76,701783 112 | 2021-05-13 10:50:00,585.12,588.26,584.57,585.0374,538497 113 | 2021-05-13 10:45:00,589.4,589.87,584.6039,585.0335,635986 114 | 2021-05-13 10:40:00,591.1501,592.3512,586.1,589.26,696360 115 | 2021-05-13 10:35:00,591.0,592.75,589.11,591.37,514504 116 | 2021-05-13 10:30:00,595.18,595.59,588.47,590.86,656752 117 | 2021-05-13 10:25:00,592.69,595.6044,591.85,595.11,535154 118 | 2021-05-13 10:20:00,596.31,597.63,592.41,592.72,591719 119 | 2021-05-13 10:15:00,599.71,600.0,596.0408,596.155,635740 120 | 2021-05-13 10:10:00,599.73,602.25,598.4,599.73,734667 121 | 2021-05-13 10:05:00,597.47,601.88,597.3299,599.56,750167 122 | 2021-05-13 10:00:00,594.0,597.88,593.5,597.3637,679271 123 | 2021-05-13 09:55:00,588.375,595.52,588.35,594.09,853274 124 | 2021-05-13 09:50:00,594.3562,596.8,587.5,588.507,950506 125 | 2021-05-13 09:45:00,595.9699,597.6,593.19,594.26,803594 126 | 2021-05-13 09:40:00,598.8868,603.24,595.81,595.91,894649 127 | 2021-05-13 09:35:00,601.545,606.4599,598.73,598.99,1417119 128 | 2021-05-13 09:30:00,605.0,605.0,601.63,602.1,46285 129 | 2021-05-13 09:25:00,603.0,605.0,602.75,604.8,64760 130 | 2021-05-13 09:20:00,600.8,602.5,600.01,602.5,27425 131 | 2021-05-13 09:15:00,603.0,603.47,601.0,601.0,23577 132 | 2021-05-13 09:10:00,603.01,603.75,601.89,603.0,28073 133 | 2021-05-13 09:05:00,599.84,604.0,599.63,602.73,46818 134 | 2021-05-13 09:00:00,599.5,600.55,598.19,599.2,20741 135 | 2021-05-13 08:55:00,600.61,601.8,599.25,599.74,24659 136 | 2021-05-13 08:50:00,603.89,604.0,601.05,601.05,40778 137 | 2021-05-13 08:45:00,599.25,604.0,599.03,603.85,49358 138 | 2021-05-13 08:40:00,597.2001,600.93,597.2001,599.25,29184 139 | 2021-05-13 08:35:00,596.39,601.0,594.5,597.12,77876 140 | 2021-05-13 08:30:00,597.01,597.47,596.0,596.29,19014 141 | 2021-05-13 08:25:00,596.0,598.15,596.0,597.0,10958 142 | 2021-05-13 08:20:00,598.41,598.5,595.61,595.61,21758 143 | 2021-05-13 08:15:00,599.5,600.74,598.2001,599.35,25688 144 | 2021-05-13 08:10:00,597.4,599.5,597.4,599.16,24621 145 | 2021-05-13 08:05:00,595.5,602.0,580.0,597.05,83591 146 | 2021-05-13 08:00:00,594.99,597.98,594.75,595.25,22955 147 | 2021-05-13 07:55:00,596.35,596.36,594.0,595.21,30280 148 | 2021-05-13 07:50:00,599.78,600.25,596.25,596.36,24540 149 | 2021-05-13 07:45:00,599.0,601.0,598.5,599.12,49680 150 | 2021-05-13 07:40:00,601.13,601.99,598.0,599.0,49825 151 | 2021-05-13 07:35:00,595.25,602.22,595.0,601.12,97553 152 | 2021-05-13 07:30:00,595.0,595.75,593.58,595.75,30363 153 | 2021-05-13 07:25:00,592.91,596.6,591.89,594.64,44414 154 | 2021-05-13 07:20:00,588.88,592.59,586.93,592.5,37054 155 | 2021-05-13 07:15:00,583.39,588.11,582.98,588.0,29202 156 | 2021-05-13 07:10:00,581.22,583.0,581.0,583.0,13567 157 | 2021-05-13 07:05:00,582.51,582.51,580.0,580.99,33585 158 | 2021-05-13 07:00:00,582.99,583.0,582.94,582.99,2089 159 | 2021-05-13 06:55:00,581.11,581.26,581.0,581.24,2532 160 | 2021-05-13 06:50:00,581.2,581.2,581.0,581.0,2752 161 | 2021-05-13 06:45:00,581.45,581.45,580.55,580.55,1184 162 | 2021-05-13 06:40:00,581.2,581.45,581.2,581.45,1217 163 | 2021-05-13 06:35:00,581.2,581.3,581.2,581.3,748 164 | 2021-05-13 06:30:00,580.25,580.25,580.25,580.25,1014 165 | 2021-05-13 06:20:00,581.0,581.08,580.59,581.08,1527 166 | 2021-05-13 06:15:00,579.3,581.52,578.75,581.52,10107 167 | 2021-05-13 06:10:00,580.42,580.42,580.01,580.11,1995 168 | 2021-05-13 06:05:00,582.25,582.25,579.99,580.0,4960 169 | 2021-05-13 06:00:00,584.6,584.94,581.15,581.15,3551 170 | 2021-05-13 05:55:00,584.1,585.0,584.1,584.95,3997 171 | 2021-05-13 05:50:00,584.0,584.0,584.0,584.0,1873 172 | 2021-05-13 05:45:00,584.0,584.0,584.0,584.0,971 173 | 2021-05-13 05:40:00,582.23,583.5,582.0,583.5,2867 174 | 2021-05-13 05:35:00,583.42,585.9,583.16,584.23,5686 175 | 2021-05-13 05:30:00,582.49,583.11,582.39,582.39,6570 176 | 2021-05-13 05:25:00,579.3,581.88,579.3,581.5,3958 177 | 2021-05-13 05:20:00,578.0,578.75,578.0,578.75,2766 178 | 2021-05-13 05:15:00,579.27,579.5,579.0,579.0,3157 179 | 2021-05-13 05:10:00,580.8,580.86,578.44,579.95,7905 180 | 2021-05-13 05:05:00,575.87,580.25,575.87,580.25,6356 181 | 2021-05-13 05:00:00,574.02,576.5,574.02,576.0,6133 182 | 2021-05-13 04:55:00,574.01,574.05,573.75,574.02,6136 183 | 2021-05-13 04:50:00,574.15,574.49,573.75,574.0,7484 184 | 2021-05-13 04:45:00,573.0,574.0,572.94,574.0,5702 185 | 2021-05-13 04:40:00,573.94,574.42,573.03,573.81,8959 186 | 2021-05-13 04:35:00,572.8,574.74,571.6,573.99,10977 187 | 2021-05-13 04:30:00,575.01,575.11,572.25,573.0,7065 188 | 2021-05-13 04:25:00,575.0,576.46,575.0,576.0,4760 189 | 2021-05-13 04:20:00,573.0,576.0,573.0,575.0,9227 190 | 2021-05-13 04:15:00,573.53,574.0,571.96,572.39,14500 191 | 2021-05-13 04:10:00,576.94,578.01,573.61,573.61,13272 192 | 2021-05-13 04:05:00,581.0,581.0,577.16,577.26,19079 193 | 2021-05-12 20:00:00,582.53,582.85,582.3,582.5,17535 194 | 2021-05-12 19:55:00,583.4,583.6,582.2,583.0,15740 195 | 2021-05-12 19:50:00,584.04,584.04,583.2,583.21,11225 196 | 2021-05-12 19:45:00,583.99,584.51,583.99,584.49,10429 197 | 2021-05-12 19:40:00,584.01,584.01,583.5,584.0,6328 198 | 2021-05-12 19:35:00,584.6,584.6,583.5001,584.4,5860 199 | 2021-05-12 19:30:00,584.78,584.9,584.49,584.5,4314 200 | 2021-05-12 19:25:00,584.63,585.0,584.5001,584.85,4045 201 | 2021-05-12 19:20:00,584.5,584.5,584.5,584.5,2614 202 | 2021-05-12 19:15:00,585.2,585.6,584.7,584.7,5683 203 | 2021-05-12 19:10:00,584.0,585.0,584.0,585.0,7770 204 | 2021-05-12 19:05:00,583.3,583.85,583.2,583.85,6613 205 | 2021-05-12 19:00:00,583.5,583.5,583.2,583.4999,5198 206 | 2021-05-12 18:55:00,582.85,584.0,582.85,583.27,9120 207 | 2021-05-12 18:50:00,582.5,583.5,582.1,583.0,8744 208 | 2021-05-12 18:45:00,581.68,582.0,580.0,581.5001,48672 209 | 2021-05-12 18:40:00,583.53,583.6,581.82,581.98,22454 210 | 2021-05-12 18:35:00,585.0,585.0,583.5,583.5,8754 211 | 2021-05-12 18:30:00,585.27,585.3,585.1,585.1,1821 212 | 2021-05-12 18:25:00,585.72,585.72,585.0,585.12,8572 213 | 2021-05-12 18:20:00,585.1,585.17,583.9,585.1,33451 214 | 2021-05-12 18:15:00,586.62,586.62,585.0,585.13,13743 215 | 2021-05-12 18:10:00,587.21,587.48,587.0,587.0,2894 216 | 2021-05-12 18:05:00,587.0,588.49,586.93,587.5,12460 217 | 2021-05-12 18:00:00,587.0,587.0,586.6,586.7,3295 218 | 2021-05-12 17:55:00,586.5,587.49,586.5,586.99,3482 219 | 2021-05-12 17:50:00,587.21,587.21,586.5,586.52,3911 220 | 2021-05-12 17:45:00,587.6,587.7,587.0,587.0,3173 221 | 2021-05-12 17:40:00,587.5,588.0,587.24,588.0,7423 222 | 2021-05-12 17:35:00,587.49,587.7,587.1,587.5,4276 223 | 2021-05-12 17:30:00,586.62,589.89,586.6,587.4,58012 224 | 2021-05-12 17:25:00,586.99,587.1,586.7,586.93,7623 225 | 2021-05-12 17:20:00,586.68,586.68,586.48,586.6,4984 226 | 2021-05-12 17:15:00,586.3,587.22,586.3,587.0,10969 227 | 2021-05-12 17:10:00,585.95,586.66,585.9,586.66,6399 228 | 2021-05-12 17:05:00,585.25,589.89,585.0,585.95,25652 229 | 2021-05-12 17:00:00,586.4,586.71,585.7,585.7,7063 230 | 2021-05-12 16:55:00,586.0,587.0,585.53,586.72,10454 231 | 2021-05-12 16:50:00,585.21,586.69,585.0,586.4999,19393 232 | 2021-05-12 16:45:00,586.5,586.64,585.0,585.48,31915 233 | 2021-05-12 16:40:00,584.89,586.75,584.25,586.69,22430 234 | 2021-05-12 16:35:00,584.86,589.89,584.51,584.53,65200 235 | 2021-05-12 16:30:00,585.9,585.9,583.0,584.95,86228 236 | 2021-05-12 16:25:00,588.62,588.62,586.0,586.0,34321 237 | 2021-05-12 16:20:00,589.72,589.89,588.5,589.0,14935 238 | 2021-05-12 16:15:00,588.95,589.7,588.02,589.7,22379 239 | 2021-05-12 16:10:00,589.3,589.9,588.05,588.77,28402 240 | 2021-05-12 16:05:00,589.89,591.0,589.5,589.5,90685 241 | 2021-05-12 16:00:00,587.16,590.4868,586.765,589.8,884073 242 | 2021-05-12 15:55:00,591.67,591.67,586.809,587.168,963239 243 | 2021-05-12 15:50:00,591.5,594.11,591.14,591.8799,479298 244 | 2021-05-12 15:45:00,592.9,593.2936,590.61,591.7277,502117 245 | 2021-05-12 15:40:00,593.82,594.09,592.5,592.91,338078 246 | 2021-05-12 15:35:00,593.0,594.4,591.65,593.9023,421073 247 | 2021-05-12 15:30:00,591.205,594.8,591.1226,593.0,476413 248 | 2021-05-12 15:25:00,591.68,593.76,591.0,591.28,457280 249 | 2021-05-12 15:20:00,593.27,594.4,591.5,591.6803,504706 250 | 2021-05-12 15:15:00,595.845,595.845,592.822,593.1871,367112 251 | 2021-05-12 15:10:00,596.0465,596.3056,594.3335,595.835,443998 252 | 2021-05-12 15:05:00,597.8,598.75,595.26,595.97,469280 253 | 2021-05-12 15:00:00,601.98,602.1377,597.7117,597.7117,320894 254 | 2021-05-12 14:55:00,601.375,602.74,601.02,601.89,278615 255 | 2021-05-12 14:50:00,599.3025,601.84,598.75,601.31,212790 256 | 2021-05-12 14:45:00,599.99,600.74,599.23,599.37,218581 257 | 2021-05-12 14:40:00,600.89,601.7999,599.3101,599.9614,300844 258 | 2021-05-12 14:35:00,600.25,601.5,598.86,600.99,255246 259 | 2021-05-12 14:30:00,599.1225,600.8223,598.25,600.37,247796 260 | 2021-05-12 14:25:00,599.44,600.36,598.51,598.81,219708 261 | 2021-05-12 14:20:00,599.52,599.9407,597.76,599.284,245831 262 | 2021-05-12 14:15:00,600.85,600.91,598.8,599.52,271665 263 | 2021-05-12 14:10:00,601.37,602.19,600.8,600.985,169058 264 | 2021-05-12 14:05:00,602.2,603.1436,600.95,601.5,200016 265 | 2021-05-12 14:00:00,603.175,604.39,601.88,602.3102,193578 266 | 2021-05-12 13:55:00,601.99,603.5,600.88,603.07,176301 267 | 2021-05-12 13:50:00,603.69,603.9999,601.2517,602.0,176599 268 | 2021-05-12 13:45:00,603.8,604.15,602.1001,603.6899,159884 269 | 2021-05-12 13:40:00,601.95,604.736,601.7,603.9,241793 270 | 2021-05-12 13:35:00,601.3709,602.99,601.03,601.77,179530 271 | 2021-05-12 13:30:00,602.68,603.49,601.1,601.7941,182409 272 | 2021-05-12 13:25:00,602.77,603.3454,602.22,602.571,135701 273 | 2021-05-12 13:20:00,604.79,605.09,602.5803,602.7,217326 274 | 2021-05-12 13:15:00,605.03,606.39,604.18,604.84,222726 275 | 2021-05-12 13:10:00,606.1528,606.84,603.95,605.0,415335 276 | 2021-05-12 13:05:00,602.73,606.48,602.2893,606.1401,392215 277 | 2021-05-12 13:00:00,602.8373,603.49,601.27,602.91,227981 278 | 2021-05-12 12:55:00,601.5,604.2,601.15,603.069,354756 279 | 2021-05-12 12:50:00,599.935,602.05,598.5533,601.3111,286653 280 | 2021-05-12 12:45:00,599.24,601.31,597.3201,600.32,319633 281 | 2021-05-12 12:40:00,599.7,600.89,597.9,599.06,305597 282 | 2021-05-12 12:35:00,596.79,599.97,595.76,599.8154,328854 283 | 2021-05-12 12:30:00,596.85,598.6,596.15,596.87,288213 284 | 2021-05-12 12:25:00,595.525,598.0,594.7,597.0444,354259 285 | 2021-05-12 12:20:00,594.46,595.62,592.06,595.461,655756 286 | 2021-05-12 12:15:00,598.23,598.32,594.3548,594.555,514879 287 | 2021-05-12 12:10:00,598.42,600.3,597.37,598.42,355847 288 | 2021-05-12 12:05:00,597.33,599.9999,596.81,598.54,436290 289 | 2021-05-12 12:00:00,597.3,598.469,596.1,597.668,399805 290 | 2021-05-12 11:55:00,602.03,602.03,597.0,597.32,521082 291 | 2021-05-12 11:50:00,602.24,602.95,600.87,602.2722,257727 292 | 2021-05-12 11:45:00,601.3,602.8,600.655,602.1501,324676 293 | 2021-05-12 11:40:00,600.8,602.3499,599.21,601.18,437271 294 | 2021-05-12 11:35:00,602.45,602.725,600.82,600.96,356238 295 | 2021-05-12 11:30:00,605.1717,605.7991,602.11,602.635,295056 296 | 2021-05-12 11:25:00,607.88,608.0799,605.11,605.34,202046 297 | 2021-05-12 11:20:00,607.34,608.23,606.12,607.95,293291 298 | 2021-05-12 11:15:00,605.745,607.62,605.24,607.42,348415 299 | 2021-05-12 11:10:00,604.35,606.11,602.2201,605.7,378739 300 | 2021-05-12 11:05:00,601.737,604.35,600.82,604.35,402357 301 | 2021-05-12 11:00:00,600.35,601.74,599.0,601.73,744848 302 | 2021-05-12 10:55:00,603.4,604.84,600.3,600.5425,387454 303 | 2021-05-12 10:50:00,602.01,604.79,601.87,603.51,403230 304 | 2021-05-12 10:45:00,604.69,605.79,601.24,602.31,456599 305 | 2021-05-12 10:40:00,603.32,605.75,602.45,604.73,558778 306 | 2021-05-12 10:35:00,604.54,605.36,602.2739,603.21,540404 307 | 2021-05-12 10:30:00,606.4,607.8599,604.52,604.7542,380190 308 | 2021-05-12 10:25:00,607.57,609.78,605.8,606.5,402257 309 | 2021-05-12 10:20:00,608.54,609.21,606.33,607.7195,433564 310 | 2021-05-12 10:15:00,613.9399,613.9399,608.22,608.582,430717 311 | 2021-05-12 10:10:00,612.503,615.2999,611.5,613.52,399904 312 | 2021-05-12 10:05:00,615.36,615.6,611.25,612.26,623683 313 | 2021-05-12 10:00:00,615.23,620.41,614.08,615.5,804931 314 | 2021-05-12 09:55:00,616.9342,618.02,613.28,615.08,826471 315 | 2021-05-12 09:50:00,608.885,618.86,608.21,616.88,1006051 316 | 2021-05-12 09:45:00,609.21,609.88,606.27,609.18,736971 317 | 2021-05-12 09:40:00,609.65,614.39,607.51,609.36,819280 318 | 2021-05-12 09:35:00,602.49,612.42,601.8,609.585,1093926 319 | 2021-05-12 09:30:00,603.3,603.3,602.0,602.49,23294 320 | 2021-05-12 09:25:00,603.02,604.95,602.0,603.52,30613 321 | 2021-05-12 09:20:00,603.2,604.3399,602.0,603.5,33546 322 | 2021-05-12 09:15:00,604.3,605.32,602.1,603.0,27463 323 | 2021-05-12 09:10:00,603.95,605.5,603.95,604.6,37585 324 | 2021-05-12 09:05:00,602.0,604.62,601.5,604.34,49356 325 | 2021-05-12 09:00:00,603.5,603.5,599.0,602.77,75295 326 | 2021-05-12 08:55:00,604.62,606.0,602.0,603.2,43234 327 | 2021-05-12 08:50:00,607.4,607.89,604.33,604.56,31585 328 | 2021-05-12 08:45:00,603.6797,608.0,602.62,607.06,52732 329 | 2021-05-12 08:40:00,603.67,605.5,602.6,602.7,60860 330 | 2021-05-12 08:35:00,611.5,611.9,601.55,603.01,124825 331 | 2021-05-12 08:30:00,612.9,612.9,611.5,612.0,8150 332 | 2021-05-12 08:25:00,613.44,613.53,612.89,613.11,4741 333 | 2021-05-12 08:20:00,613.8,614.85,612.9,613.0,19953 334 | 2021-05-12 08:15:00,613.12,613.8,613.0,613.8,2680 335 | 2021-05-12 08:10:00,612.98,613.08,612.8,613.0,2281 336 | 2021-05-12 08:05:00,613.87,614.49,611.02,613.2,14967 337 | 2021-05-12 07:55:00,613.6,613.7,613.6,613.7,1142 338 | 2021-05-12 07:50:00,613.75,614.2,613.75,613.75,2578 339 | 2021-05-12 07:45:00,612.55,613.4,612.0,613.4,5880 340 | 2021-05-12 07:40:00,613.11,613.11,612.5,612.99,3302 341 | 2021-05-12 07:35:00,613.75,614.45,613.5,613.5,4971 342 | 2021-05-12 07:25:00,613.89,613.89,613.89,613.89,905 343 | 2021-05-12 07:20:00,613.5,613.7,612.0,612.35,6650 344 | 2021-05-12 07:15:00,612.59,612.99,612.49,612.99,3966 345 | 2021-05-12 07:10:00,613.75,614.45,611.5,612.9,9754 346 | 2021-05-12 07:05:00,612.5,614.49,612.5,613.68,5686 347 | 2021-05-12 07:00:00,612.5,612.71,612.5,612.71,788 348 | 2021-05-12 06:55:00,613.11,613.12,612.0,612.99,2590 349 | 2021-05-12 06:50:00,615.0,615.0,615.0,615.0,607 350 | 2021-05-12 06:45:00,617.0,617.2,616.66,616.66,2183 351 | 2021-05-12 06:35:00,616.0,616.7,616.0,616.7,2980 352 | 2021-05-12 06:30:00,615.5,615.5,615.14,615.5,1906 353 | 2021-05-12 06:25:00,616.0,616.0,616.0,616.0,1893 354 | 2021-05-12 06:20:00,614.94,615.0,614.94,615.0,965 355 | 2021-05-12 06:15:00,614.15,614.15,613.7,613.7,1646 356 | 2021-05-12 06:05:00,613.4,613.4,613.4,613.4,208 357 | 2021-05-12 06:00:00,613.6,613.6,613.4,613.4,473 358 | 2021-05-12 05:50:00,612.99,612.99,612.99,612.99,599 359 | 2021-05-12 05:35:00,614.17,614.17,614.17,614.17,584 360 | 2021-05-12 05:30:00,616.31,616.31,615.09,615.09,1283 361 | 2021-05-12 05:25:00,615.95,616.0,615.8,616.0,681 362 | 2021-05-12 05:20:00,616.54,616.54,616.01,616.01,947 363 | 2021-05-12 05:15:00,613.0,616.5,613.0,616.0,1781 364 | 2021-05-12 05:10:00,612.99,612.99,612.99,612.99,414 365 | 2021-05-12 04:50:00,610.33,610.4,610.33,610.4,1262 366 | 2021-05-12 04:45:00,611.7,611.88,611.0,611.02,3876 367 | 2021-05-12 04:40:00,612.25,612.25,612.07,612.07,1265 368 | 2021-05-12 04:35:00,613.71,613.71,613.0,613.0,2803 369 | 2021-05-12 04:30:00,614.37,614.37,614.37,614.37,367 370 | 2021-05-12 04:25:00,613.71,614.05,613.61,614.05,549 371 | 2021-05-12 04:20:00,615.55,615.55,613.71,615.04,3557 372 | 2021-05-12 04:15:00,616.53,616.53,615.04,615.04,2219 373 | 2021-05-12 04:10:00,618.6,618.6,615.85,616.02,3997 374 | 2021-05-12 04:05:00,618.3,620.0,617.0,619.5,6113 375 | 2021-05-11 20:00:00,615.6,615.75,614.5,615.75,15537 376 | 2021-05-11 19:55:00,615.75,616.0,615.67,615.67,4769 377 | 2021-05-11 19:50:00,616.15,616.15,615.5,615.5,4582 378 | 2021-05-11 19:45:00,616.31,616.7,616.3,616.3,2788 379 | 2021-05-11 19:40:00,616.7,616.7,616.7,616.7,320 380 | 2021-05-11 19:35:00,616.5,616.5,616.5,616.5,309 381 | 2021-05-11 19:30:00,615.75,616.0,615.7,616.0,4832 382 | 2021-05-11 19:25:00,615.79,615.79,615.5001,615.79,1163 383 | 2021-05-11 19:20:00,616.0,616.0,616.0,616.0,486 384 | 2021-05-11 19:15:00,615.65,615.65,615.62,615.62,477 385 | 2021-05-11 19:10:00,616.07,616.07,615.5,615.66,3999 386 | 2021-05-11 19:05:00,616.7,616.7,616.0,616.4,4310 387 | 2021-05-11 19:00:00,616.49,617.08,616.49,617.08,6152 388 | 2021-05-11 18:50:00,616.12,616.5,616.12,616.5,1468 389 | 2021-05-11 18:45:00,616.39,616.4,616.39,616.4,2135 390 | 2021-05-11 18:40:00,616.39,616.39,616.07,616.07,729 391 | 2021-05-11 18:35:00,615.97,616.5,615.97,616.48,897 392 | 2021-05-11 18:30:00,615.99,616.0,615.7,615.7,1153 393 | 2021-05-11 18:25:00,615.5,615.99,615.5,615.99,1738 394 | 2021-05-11 18:20:00,616.0,616.0,615.97,615.98,1830 395 | 2021-05-11 18:15:00,615.54,615.54,615.54,615.54,276 396 | 2021-05-11 18:10:00,615.97,615.97,615.55,615.55,523 397 | 2021-05-11 18:05:00,615.4,615.75,615.4,615.5,1801 398 | 2021-05-11 18:00:00,615.85,615.85,615.4,615.4,1277 399 | 2021-05-11 17:55:00,616.06,616.06,615.5,615.5,4805 400 | 2021-05-11 17:50:00,616.0,616.49,616.0,616.49,1554 401 | 2021-05-11 17:45:00,615.75,615.75,615.75,615.75,341 402 | 2021-05-11 17:40:00,616.4,616.49,616.4,616.47,1236 403 | 2021-05-11 17:35:00,615.83,616.0,615.71,616.0,2306 404 | 2021-05-11 17:30:00,616.0,616.0,616.0,616.0,552 405 | 2021-05-11 17:25:00,616.3,616.3,615.8,615.8,1833 406 | 2021-05-11 17:20:00,616.25,616.25,616.05,616.25,1634 407 | 2021-05-11 17:15:00,615.84,616.25,615.6,615.98,3224 408 | 2021-05-11 17:10:00,615.11,615.11,615.04,615.04,1177 409 | 2021-05-11 17:05:00,615.0,615.84,615.0,615.7,7826 410 | 2021-05-11 17:00:00,614.5,614.83,614.21,614.83,4096 411 | 2021-05-11 16:55:00,615.0,615.11,615.0,615.0,2083 412 | 2021-05-11 16:50:00,614.21,617.2,614.0,615.0,30714 413 | 2021-05-11 16:45:00,614.35,614.41,614.35,614.41,1385 414 | 2021-05-11 16:40:00,613.55,614.47,613.55,613.98,5875 415 | 2021-05-11 16:35:00,613.82,614.02,613.36,613.65,11603 416 | 2021-05-11 16:30:00,614.16,614.55,613.15,613.9,13282 417 | 2021-05-11 16:25:00,614.7,617.2,614.4,614.4,13215 418 | 2021-05-11 16:20:00,615.5,615.5,613.1,614.5,23048 419 | 2021-05-11 16:15:00,615.6,616.4,615.3,615.3,9044 420 | 2021-05-11 16:10:00,617.02,617.2399,615.5,615.6,19691 421 | 2021-05-11 16:05:00,617.2,617.61,616.9,617.3,104892 422 | 2021-05-11 16:00:00,619.355,619.448,616.78,617.04,607087 423 | 2021-05-11 15:55:00,621.25,621.25,618.4,619.4168,394661 424 | 2021-05-11 15:50:00,621.11,622.81,620.38,621.18,375503 425 | 2021-05-11 15:45:00,620.39,622.0,620.16,621.215,263845 426 | 2021-05-11 15:40:00,620.97,622.0501,619.97,620.41,335650 427 | 2021-05-11 15:35:00,624.51,625.0569,620.72,620.73,493516 428 | 2021-05-11 15:30:00,623.322,627.0999,623.2901,624.4,673328 429 | 2021-05-11 15:25:00,623.0996,624.2,622.0,623.6499,426678 430 | 2021-05-11 15:20:00,617.11,623.16,616.88,623.0,469971 431 | 2021-05-11 15:15:00,616.02,617.66,616.02,617.155,218231 432 | 2021-05-11 15:10:00,618.7615,619.49,615.8904,616.1383,233563 433 | 2021-05-11 15:05:00,618.6,620.0,618.0,618.7467,194766 434 | 2021-05-11 15:00:00,620.25,621.31,618.26,618.68,221313 435 | 2021-05-11 14:55:00,620.33,621.1994,618.26,620.395,319641 436 | 2021-05-11 14:50:00,618.5301,620.78,618.05,620.7235,292166 437 | 2021-05-11 14:45:00,618.25,619.85,617.6,618.5,224257 438 | 2021-05-11 14:40:00,620.1,620.79,617.65,618.37,224811 439 | 2021-05-11 14:35:00,622.7,623.219,619.0,620.06,304125 440 | 2021-05-11 14:30:00,619.19,623.47,619.0861,622.88,393794 441 | 2021-05-11 14:25:00,618.0326,619.5,617.89,619.24,286893 442 | 2021-05-11 14:20:00,617.1,617.99,615.55,617.9597,263073 443 | 2021-05-11 14:15:00,619.0387,619.67,616.3,617.283,248899 444 | 2021-05-11 14:10:00,620.984,622.0,618.89,619.03,210145 445 | 2021-05-11 14:05:00,619.63,621.89,618.4,621.02,424668 446 | 2021-05-11 14:00:00,619.52,620.28,617.84,619.6271,360467 447 | 2021-05-11 13:55:00,621.95,622.12,619.16,619.52,373632 448 | 2021-05-11 13:50:00,624.53,624.65,621.64,621.95,362316 449 | 2021-05-11 13:45:00,622.16,624.9882,621.4001,624.32,411017 450 | 2021-05-11 13:40:00,621.193,623.0,620.51,622.1999,376359 451 | 2021-05-11 13:35:00,620.2545,622.17,619.75,621.092,335983 452 | 2021-05-11 13:30:00,617.81,620.6005,617.66,620.186,343659 453 | 2021-05-11 13:25:00,614.79,617.94,614.4895,617.66,315050 454 | 2021-05-11 13:20:00,612.755,615.1885,612.0,614.89,206511 455 | 2021-05-11 13:15:00,614.4,615.0051,612.16,612.46,212710 456 | 2021-05-11 13:10:00,614.48,615.7199,613.52,614.4,286048 457 | 2021-05-11 13:05:00,611.28,614.5,610.35,614.4369,343776 458 | 2021-05-11 13:00:00,610.2599,611.47,609.2501,611.3466,316782 459 | 2021-05-11 12:55:00,613.1037,613.41,609.56,610.215,296811 460 | 2021-05-11 12:50:00,612.86,614.22,612.4,613.0965,173453 461 | 2021-05-11 12:45:00,613.6582,613.95,611.7,612.8,228520 462 | 2021-05-11 12:40:00,612.36,614.88,611.1,613.52,398885 463 | 2021-05-11 12:35:00,614.4094,614.87,611.5,611.9915,372541 464 | 2021-05-11 12:30:00,616.7,616.7,613.63,614.4101,391849 465 | 2021-05-11 12:25:00,619.08,619.4,616.09,616.8,333753 466 | 2021-05-11 12:20:00,619.7034,620.75,618.54,619.2,331963 467 | 2021-05-11 12:15:00,619.5529,621.88,618.3,619.6558,345783 468 | 2021-05-11 12:10:00,618.1224,621.0,617.21,619.64,474697 469 | 2021-05-11 12:05:00,614.955,619.8687,613.6,618.3448,591595 470 | 2021-05-11 12:00:00,615.65,616.42,614.17,614.77,313932 471 | 2021-05-11 11:55:00,613.33,616.66,612.49,615.67,361785 472 | 2021-05-11 11:50:00,611.2604,614.89,610.59,613.42,439015 473 | 2021-05-11 11:45:00,616.68,617.08,610.58,611.23,466381 474 | 2021-05-11 11:40:00,612.79,617.72,612.06,616.83,526539 475 | 2021-05-11 11:35:00,615.45,617.0,612.67,612.67,489855 476 | 2021-05-11 11:30:00,615.1001,618.4,614.67,615.38,621413 477 | 2021-05-11 11:25:00,613.0603,616.25,610.67,615.1001,775468 478 | 2021-05-11 11:20:00,608.39,613.53,607.4,612.97,623752 479 | 2021-05-11 11:15:00,604.06,608.74,603.34,608.6414,540396 480 | 2021-05-11 11:10:00,602.83,605.5055,602.27,603.96,429547 481 | 2021-05-11 11:05:00,608.36,608.3999,602.571,603.08,514395 482 | 2021-05-11 11:00:00,610.2,612.0,607.13,608.23,489983 483 | 2021-05-11 10:55:00,607.0,612.4699,606.3201,610.1,708040 484 | 2021-05-11 10:50:00,604.88,608.59,602.29,606.58,954076 485 | 2021-05-11 10:45:00,602.05,608.33,601.3501,604.9561,914930 486 | 2021-05-11 10:40:00,604.28,606.66,600.3,602.21,988188 487 | 2021-05-11 10:35:00,604.51,606.98,602.34,604.26,882767 488 | 2021-05-11 10:30:00,612.49,612.7999,604.16,604.43,1019786 489 | 2021-05-11 10:25:00,613.87,616.91,611.1,612.305,716959 490 | 2021-05-11 10:20:00,617.5,618.6,610.75,613.77,974922 491 | 2021-05-11 10:15:00,614.6993,620.0,614.4225,617.69,733557 492 | 2021-05-11 10:10:00,621.46,622.4734,614.2735,614.39,1067711 493 | 2021-05-11 10:05:00,625.24,625.6,619.54,621.51,989472 494 | 2021-05-11 10:00:00,619.435,625.34,616.73,625.2267,1045112 495 | 2021-05-11 09:55:00,607.38,621.0,607.38,619.19,1262680 496 | 2021-05-11 09:50:00,613.4895,614.66,606.16,607.6896,1135007 497 | 2021-05-11 09:45:00,604.0,616.86,603.9825,613.4515,1592223 498 | 2021-05-11 09:40:00,599.13,606.0,595.6,604.1484,1625950 499 | 2021-05-11 09:35:00,599.24,608.79,596.87,598.93,2789103 500 | 2021-05-11 09:30:00,591.24,599.5,590.49,599.19,177872 501 | 2021-05-11 09:25:00,591.97,595.25,590.1301,591.0,142021 502 | 2021-05-11 09:20:00,588.9,593.55,587.6,592.25,140942 503 | 2021-05-11 09:15:00,585.46,589.39,585.22,588.64,140030 504 | 2021-05-11 09:10:00,583.88,586.1,582.69,585.25,138023 505 | 2021-05-11 09:05:00,582.64,584.48,580.3,583.9,189707 506 | 2021-05-11 09:00:00,580.25,583.7,580.01,582.9,69684 507 | 2021-05-11 08:55:00,580.59,581.4,579.12,580.21,46728 508 | 2021-05-11 08:50:00,580.8,581.37,579.7,581.0,52555 509 | 2021-05-11 08:45:00,579.73,581.32,579.02,580.45,57513 510 | 2021-05-11 08:40:00,580.56,582.0,579.66,579.66,93997 511 | 2021-05-11 08:35:00,580.0,581.0,578.0,580.5,115655 512 | 2021-05-11 08:30:00,583.53,583.9999,579.3,579.52,134664 513 | 2021-05-11 08:25:00,584.09,585.5,583.5,583.55,65390 514 | 2021-05-11 08:20:00,584.85,585.99,581.99,584.0,110010 515 | 2021-05-11 08:15:00,586.669,586.669,582.51,584.62,119607 516 | -------------------------------------------------------------------------------- /spec/fixtures/time_series/monthly.json: -------------------------------------------------------------------------------- 1 | { 2 | "Meta Data": { 3 | "1. Information": "Monthly Prices (open, high, low, close) and Volumes", 4 | "2. Symbol": "TSLA", 5 | "3. Last Refreshed": "2021-04-23", 6 | "4. Time Zone": "US/Eastern" 7 | }, 8 | "Monthly Time Series": { 9 | "2021-04-23": { 10 | "1. open": "688.3700", 11 | "2. high": "780.7900", 12 | "3. low": "659.4200", 13 | "4. close": "729.4000", 14 | "5. volume": "525522527" 15 | }, 16 | "2021-03-31": { 17 | "1. open": "690.1100", 18 | "2. high": "721.1100", 19 | "3. low": "539.4900", 20 | "4. close": "667.9300", 21 | "5. volume": "941564582" 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /spec/fixtures/time_series/monthly_adjusted.json: -------------------------------------------------------------------------------- 1 | { 2 | "Meta Data": { 3 | "1. Information": "Monthly Adjusted Prices and Volumes", 4 | "2. Symbol": "TSLA", 5 | "3. Last Refreshed": "2021-04-23", 6 | "4. Time Zone": "US/Eastern" 7 | }, 8 | "Monthly Adjusted Time Series": { 9 | "2021-04-23": { 10 | "1. open": "688.3700", 11 | "2. high": "780.7900", 12 | "3. low": "659.4200", 13 | "4. close": "729.4000", 14 | "5. adjusted close": "729.4000", 15 | "6. volume": "525522527", 16 | "7. dividend amount": "0.0000" 17 | }, 18 | "2021-03-31": { 19 | "1. open": "690.1100", 20 | "2. high": "721.1100", 21 | "3. low": "539.4900", 22 | "4. close": "667.9300", 23 | "5. adjusted close": "667.9300", 24 | "6. volume": "941564582", 25 | "7. dividend amount": "0.0000" 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /spec/fixtures/time_series/quote.json: -------------------------------------------------------------------------------- 1 | { 2 | "Global Quote": { 3 | "01. symbol": "TSLA", 4 | "02. open": "719.8000", 5 | "03. high": "737.3600", 6 | "04. low": "715.4600", 7 | "05. price": "729.4000", 8 | "06. volume": "27879033", 9 | "07. latest trading day": "2021-04-23", 10 | "08. previous close": "719.6900", 11 | "09. change": "9.7100", 12 | "10. change percent": "1.3492%" 13 | } 14 | } -------------------------------------------------------------------------------- /spec/fixtures/time_series/search.json: -------------------------------------------------------------------------------- 1 | { 2 | "bestMatches": [ 3 | { 4 | "1. symbol": "TL0.DEX", 5 | "2. name": "Tesla", 6 | "3. type": "Equity", 7 | "4. region": "XETRA", 8 | "5. marketOpen": "08:00", 9 | "6. marketClose": "20:00", 10 | "7. timezone": "UTC+02", 11 | "8. currency": "EUR", 12 | "9. matchScore": "1.0000" 13 | }, 14 | { 15 | "1. symbol": "TL0.FRK", 16 | "2. name": "Tesla", 17 | "3. type": "Equity", 18 | "4. region": "Frankfurt", 19 | "5. marketOpen": "08:00", 20 | "6. marketClose": "20:00", 21 | "7. timezone": "UTC+02", 22 | "8. currency": "EUR", 23 | "9. matchScore": "1.0000" 24 | }, 25 | { 26 | "1. symbol": "TSLA34.SAO", 27 | "2. name": "Tesla", 28 | "3. type": "Equity", 29 | "4. region": "Brazil/Sao Paolo", 30 | "5. marketOpen": "10:00", 31 | "6. marketClose": "17:30", 32 | "7. timezone": "UTC-03", 33 | "8. currency": "BRL", 34 | "9. matchScore": "1.0000" 35 | }, 36 | { 37 | "1. symbol": "TSLA", 38 | "2. name": "Tesla Inc", 39 | "3. type": "Equity", 40 | "4. region": "United States", 41 | "5. marketOpen": "09:30", 42 | "6. marketClose": "16:00", 43 | "7. timezone": "UTC-04", 44 | "8. currency": "USD", 45 | "9. matchScore": "0.8889" 46 | }, 47 | { 48 | "1. symbol": "TXLZF", 49 | "2. name": "Tesla Exploration Ltd", 50 | "3. type": "Equity", 51 | "4. region": "United States", 52 | "5. marketOpen": "09:30", 53 | "6. marketClose": "16:00", 54 | "7. timezone": "UTC-04", 55 | "8. currency": "USD", 56 | "9. matchScore": "0.4000" 57 | } 58 | ] 59 | } -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require "bundler/setup" 2 | require "alphavantage" 3 | require "webmock/rspec" 4 | require "support/file_fixture" 5 | require "byebug" 6 | 7 | RSpec.configure do |config| 8 | config.include FileFixture 9 | 10 | # Enable flags like --only-failures and --next-failure 11 | config.example_status_persistence_file_path = ".rspec_status" 12 | 13 | # Disable RSpec exposing methods globally on `Module` and `main` 14 | config.disable_monkey_patching! 15 | 16 | config.expect_with :rspec do |c| 17 | c.syntax = :expect 18 | end 19 | 20 | # Disable the need to prefix `describe` with `RSpec.` 21 | # https://relishapp.com/rspec/rspec-core/v/3-0/docs/configuration/global-namespace-dsl 22 | config.expose_dsl_globally = true 23 | end 24 | -------------------------------------------------------------------------------- /spec/support/file_fixture.rb: -------------------------------------------------------------------------------- 1 | module FileFixture 2 | def file_fixture(filename) 3 | Pathname.new(__FILE__).join('..','..','fixtures',filename).read 4 | end 5 | end --------------------------------------------------------------------------------