sqa 0.0.20 → 0.0.22

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eaf6c6d975b4bb899fc3f82e79b1fb87b6f4cdad17b19d7e2c5b8300d8cce107
4
- data.tar.gz: 2b06b6ffcc711e4d593e18ba7f68508bfb423d60be9d4358ef0953ce2a8983d7
3
+ metadata.gz: d905658af9c43b28516a66c068064fb83391b278885fbc6804a934be463cf316
4
+ data.tar.gz: c8b8699dc6209b3370d72a34a43a29de70f6cf4f7e543766b676be6a249e879c
5
5
  SHA512:
6
- metadata.gz: 9ddbd102bb0aa138c39177f4900159e5767739c60943e3ea5d03c07b0cfd1cdfa6cd78db3ea13f502aeee4a31826be64fb36e3d8f9ffa895c30263d5577e6759
7
- data.tar.gz: 3b9365d693970575b0d922deccb2c37261ebb4a0ffe5c35109522e85ad861410d2391914b6a3ea7ff4b01d84be721470ee3dc783086517a0e55de84161e2d1c4
6
+ metadata.gz: 8351015c1c4b75c8b75d2460820d4d162ad51b9e29d60c0989ecd413485670f6c4d55a65a2f52667bcf1c24bda04df3c6fc8bad196a92b2f8c3319c005e977c0
7
+ data.tar.gz: 120bef4ce4c29cbf5ab412bb918f710f0875243cefef5bb085bcea8c29080b5754a42a313eb24b5b33aa4d5a3667e2147ceb97567941f528712a7ee42c56b32d
@@ -0,0 +1,5 @@
1
+ label: "## Table of Contents"
2
+ patterns:
3
+ - "README.md"
4
+ - "docs/terms_of_use.md"
5
+ root_dir: "."
data/README.md CHANGED
@@ -4,9 +4,36 @@ This is a very simplistic set of tools for running technical analysis (quantitat
4
4
 
5
5
  The BUY/SELL signals that it generates should not be taken seriously. **DO NOT USE** this library when real money is at stake. If you lose your shirt playing in the stock market don't come crying to me. I think playing in the market is like playing in the street. You are going to get run over.
6
6
 
7
+ <!-- Tocer[start]: Auto-generated, don't remove. -->
8
+
9
+ ## Table of Contents
10
+
11
+ - [This is a Work in Progress](#this-is-a-work-in-progress)
12
+ - [Installation](#installation)
13
+ - [Semantic Versioning](#semantic-versioning)
14
+ - [Usage](#usage)
15
+ - [Setup a Config File](#setup-a-config-file)
16
+ - [AlphaVantage](#alphavantage)
17
+ - [TradingView](#tradingview)
18
+ - [Yahoo Finance](#yahoo-finance)
19
+ - [Playing in IRB](#playing-in-irb)
20
+ - [With Stocks and Indicators](#with-stocks-and-indicators)
21
+ - [Get Historical Prices](#get-historical-prices)
22
+ - [Playing in the IRB - Setup](#playing-in-the-irb---setup)
23
+ - [Playing in the IRB - Statistics](#playing-in-the-irb---statistics)
24
+ - [Playing in the IRB - Indicators](#playing-in-the-irb---indicators)
25
+ - [Playing in the IRB - Strategies](#playing-in-the-irb---strategies)
26
+ - [Included Program Examples](#included-program-examples)
27
+ - [Analysis](#analysis)
28
+ - [Web](#web)
29
+ - [Contributing](#contributing)
30
+ - [License](#license)
31
+
32
+ <!-- Tocer[finish]: Auto-generated, don't remove. -->
33
+
7
34
  ## This is a Work in Progress
8
35
 
9
- I am experimenting with different gems to support various functionality. Sometimes they do not work out well. For example I've gone through two different gems to implement the data frame capability. Neither did what I wanted so I ended up creating my own data frame class based upon the old tried and true Hashie library.
36
+ I am experimenting with different gems to support various functionality. Sometimes they do not work out well. For example I've gone through two different gems to implement the data frame capability. Neither did what I wanted so I ended up creating my own data frame class based upon the old tried and true [Hashie](https://github.com/intridea/hashie) library.
10
37
 
11
38
 
12
39
  ## Installation
@@ -19,11 +46,22 @@ If bundler is not being used to manage dependencies, install the gem by executin
19
46
 
20
47
  gem install sqa
21
48
 
22
- ### Semantic Versioning
49
+ ## Semantic Versioning
50
+
51
+ `sqa` uses the [sem_version](https://github.com/canton7/sem_version) gem to provide a semantic version object. Sure its old; but, so am I. Doesn't mean we can't do the job.
23
52
 
24
53
  ```ruby
54
+ # On the command line:
55
+ sqa --version
56
+
57
+ # or inside your program:
58
+
25
59
  SQA.version # returns SemVersion object
26
60
  exit(1) unless SQA.version >= SemVersion("1.0.0")
61
+
62
+ # Okay, you're right, you could put that kind of version
63
+ # constraint in a Gemfile and let bundler handle the
64
+ # dependencies for you.
27
65
  ```
28
66
 
29
67
  ## Usage
@@ -65,6 +103,9 @@ Examples:
65
103
 
66
104
  WARNING: This is a toy, a play thing, not intended for serious use.
67
105
  ```
106
+
107
+ More about the two included programs `analysis` and `web` later.
108
+
68
109
  ### Setup a Config File
69
110
 
70
111
  You will need to create a directory to store the `sqa` data and a configuration file. You can start by doing this:
@@ -77,6 +118,9 @@ sqa --data-dir ~/Documents/sqa_data --dump-config ~/.sqa.yml
77
118
 
78
119
  By default `SQA` looks for a configuration file named `.sqa.yml` in the current directory. If it does not find one there it looks in the home directory. You can use the `--config` CLI option to specify a path to your custom config file name.
79
120
 
121
+ You can have multiple configurations and multiple data directories.
122
+
123
+ You can also have one data directory and multiple portfolio and trades files within that single directory.
80
124
 
81
125
  ### AlphaVantage
82
126
 
@@ -84,6 +128,33 @@ By default `SQA` looks for a configuration file named `.sqa.yml` in the current
84
128
 
85
129
  [https://www.alphavantage.co/](https://www.alphavantage.co/)
86
130
 
131
+ Put your API key in the system environment variable `AV_API_KEY`
132
+
133
+ <!-- TODO: why is it not part of the configuration? ought to be. -->
134
+
135
+
136
+ ### TradingView
137
+
138
+ **Not currently implemented** but seriously considering using [TradingView](http://tradingview.com) capabilities. If I do choose to use these capabilities you will need your own API key or account or something.
139
+
140
+ Put your API key in the system environment variable `TV_API_KEY`
141
+
142
+ <!-- TODO: why is it not part of the configuration? ought to be. -->
143
+
144
+ I kinda like their Terms of Use. I've started crafting an [SQA Terms of Use](docs/terms_of_use.md) document based on theirs. I specifically like sections 7 and 8.
145
+
146
+ ### Yahoo Finance
147
+
148
+ The finance.yahoo.com website no longer supports an API. To get information from this website you must scrape it. That is how historical / receint stock prices are being obtained in the DataFrame::YahooFinance class. I do not like doing this and do not necessarily recommend using YahooFinance as a source for stock price data.
149
+
150
+ In the SQA::Stock class the default source is AlphaVantage which has its own limitations.
151
+
152
+ This is not to say that finance.yahoo.com has no use. In fact is is the perfect place to go to manually download CSV files of historical stock price data. When you do that through your browser, the CSV file will be placed in your default downloads directory.
153
+
154
+ To use this downed file within the SQA environment it must be moved into your `SQA.`data_dir` with a filename that is all lowercase. The filename must be the stock's symbol with a `.csv` extension. For example if you downloaded the entire historical stock price data for Apple Computer (AAPL) the filename in the SQA.data_dir should be "aapl.csv"
155
+
156
+ You can manually go to the Yahoo Finance website at [https://finance.yahoo.com/quote/AAPL/history?p=AAPL](https://finance.yahoo.com/quote/AAPL/history?p=AAPL)
157
+
87
158
 
88
159
  ## Playing in IRB
89
160
 
@@ -98,11 +169,13 @@ Historical price data is kept in the `SQA.data_dir` in a CSV file whose name is
98
169
 
99
170
  #### Get Historical Prices
100
171
 
101
- Go to https::/finance.yahoo.com and down some historical price data for your favorite stocks. Put those CSV files into the `SQA.data_dir`.
172
+ Go to [https::/finance.yahoo.com](https::/finance.yahoo.com) and down some historical price data for your favorite stocks. Put those CSV files into the `SQA.data_dir`.
102
173
 
103
- You may need to create a `portfolio.csv` file or you may not. TODO
174
+ You may need to create a `portfolio.csv` file or you may not.
104
175
 
105
- The CSV files will be named by the stock's ticker symbol. For example: `aapl.csv`
176
+ <!-- TODO: Add a section on how to create a portfolio fCSV file -->
177
+
178
+ The CSV files will be named by the stock's ticker symbol as lower case. For example: `aapl.csv`
106
179
 
107
180
  ### Playing in the IRB - Setup
108
181
 
@@ -113,6 +186,9 @@ require 'sqa/cli'
113
186
  # You can pass a set of CLI options in a String
114
187
  SQA.init "-c ~/.sqa.yml"
115
188
 
189
+ # If you have an API key for AlphaVantage you can create a new
190
+ # CSV file, or update an existing one. Your key MUST be
191
+ # in the system environment variable AV_API_KEY
116
192
  aapl = SQA::Stock.new(ticker: 'aapl', source: :alpha_vantage)
117
193
  #=> aapl with 1207 data points from 2019-01-02 to 2023-10-17
118
194
  ```
@@ -229,7 +305,7 @@ ss.add SQA::Strategy::RSI
229
305
 
230
306
  # This is an Array with each "trade" method
231
307
  # that is defined in each strategy added
232
- ap ss.strategies
308
+ ap ss.strategies #=>∑
233
309
  [
234
310
  [0] SQA::Strategy::Random#trade(vector),
235
311
  [1] SQA::Strategy::RSI#trade(vector)
@@ -248,6 +324,24 @@ Any specific strategy may not work on every stock. Using the historical data, it
248
324
 
249
325
  The strategies that come with the `SQA::Strategy` class are examples only. Its expected that you will come up with your own. If you do, consider sharing them.
250
326
 
327
+ ## Included Program Examples
328
+
329
+ <!-- TODO: What is the name of these things? From the help text they are called commands. They are treated in the code base as a class under the SQA module. Its easy to change the CLI help text to call these programs rather than commands. -->
330
+
331
+ There are at least two included programs that make use of the `SQA` library.
332
+
333
+ <!-- TODO: These kinds of things need to be in their own repository. -->
334
+
335
+ <!-- TODO: Need to complete the API for invoking one of these "programs" from the sqa cli. -->
336
+
337
+ ### Analysis
338
+
339
+ Does an analysis of a portfollio of stocks.
340
+
341
+ ### Web
342
+
343
+ Provides a browser-based interface to some stuff.
344
+
251
345
  ## Contributing
252
346
 
253
347
  I can always use some help on this stuff. Got an idea for a new indicator or strategy? Want to improve the math? Make the signals better? Let's collaborate!
data/Rakefile CHANGED
@@ -1,5 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+
4
+
5
+ begin
6
+ require "tocer/rake/register"
7
+ rescue LoadError => error
8
+ puts error.message
9
+ end
10
+
11
+ Tocer::Rake::Register.call
12
+
13
+
14
+
3
15
  require "bundler/gem_tasks"
4
16
  require "minitest/test_task"
5
17
 
@@ -1 +1 @@
1
- 46d87a1698df7159658dbb5be0d8d3b50209d85cac5085c5d7ee904b1d095c955a25f5f89a79f1af9a0a8c64cda51db58ebb8ae0b23ded2f8d4d680d8ed49606
1
+ 800bf4a6582451931c1d3aa75ca783fc8d9a12cb473d14d9b383b65b59207e44fe9ece2936ecd05d3b72d5a26861e75b8276b2f916fbf4b0532477d0d8262208
@@ -0,0 +1 @@
1
+ 5e682462398140077e381829872acc847ce0f2a391af4ab7d66c94f8bebf05dc29a760fcdfecfe07886ad23440496973e6f6cdd7012d6db577b923281e1f67b7
@@ -0,0 +1 @@
1
+ 053cf9a393976ae5292918cd7386b9c2e0567788f43525b77ca06ee574a98b39c3d81d43d65358d2d8cf896060e576897484945c119f1f2d57480d9407c0555a
data/docs/README.md CHANGED
@@ -1,33 +1,43 @@
1
- # Indicators
1
+ # README.md
2
2
 
3
- An indicator is a formula/metric on a stock's historical activity. It is presumed to be a forecast as to what the stock activity might be in the future. A single indicator is not necessarily an accurate predictor of future events not is any specific group of indicators.
3
+ "Playing the market" has always felt like "playing roulette" at the casino - "you pays your money and you takes your chances". Some players are winners. Some are losers. But **the House Always Wins.**
4
4
 
5
- In other words the future is uncertain. Is it a coin flip? Heads the stock's price goes up. Tails, the stock's price goes down. Its one or the other right? What if the price never changes. Then its not a coin flip. Also what is the time frame involved in the forecast? Is it tomorrow, next week, next month, next year, next decade? What is the delta change in price that can be expected?
5
+ Before computers, swings in the market were caused by people. These days I believe that computers have more to do with it than public trader sentiment. One computer program can start a cascade of other computer programs selling or buying in a digital frenzy of trading chaos.
6
6
 
7
- So indicators are like TV weather forecastors. Sometimes they are right. Sometimes they are wrong.
7
+ There are supposed to be tripwires in the system that protect against such things.
8
8
 
9
- We are dealing with uncertainity. In uncertainity there is chaos. If it is possible to be right more times that you are wrong you can make money. If you are always wrong then always do the opposite and you will make money. When you are wrong more times than you are right.... you loose.
9
+ ## Recent Computer-caused Chaos
10
10
 
11
- Its a game. Game theory tells us that there are winners and losers. Bookies at the track make money every day by taking a cut of the losers loses before giving them to the winners. Bookies always win so long as they keep their books balanced. Accounts are important.
11
+ I asked my AI assistant "do you know of any times when computer programs caused trading chaos in the stock market?"
12
12
 
13
- Back to indicators. Here is a list of the current indicators:
13
+ Yes, there have been several instances in history when computer programs have contributed to chaos in the stock market. Here are a few notable examples:
14
14
 
15
+ 1. **Flash Crash, 2010:** On May 6, 2010, U.S. financial markets experienced a brief, severe, and rapidly-reversed drop in stock prices. The Dow Jones Industrial Average plunged by over 1,000 points in a matter of minutes, only to recover just as quickly. This event is known as the "Flash Crash". The crash was primarily blamed on high-frequency trading algorithms - computer programs that execute trades at incredibly high speeds.
15
16
 
17
+ 2. **Knight Capital Group Incident, 2012:** On August 1, 2012, the company Knight Capital Group experienced a major malfunction in its automated trading software. The software executed trades worth $7 billion in about half an hour, causing Knight Capital's stock price to collapse and leading to a $440 million loss for the company.
16
18
 
17
- * [Average True Range](average true range.md)
18
- * [Bollinger Bands](bollinger bands.md)
19
- * [Vandlestick Pattern Recognizer](candlestick pattern recognizer.md)
20
- * [Vlassify Market Profile](classify market profile.md)
21
- * [Donchian Channel](donchian channel.md)
22
- * [Double Top Bottom Pattern](double top bottom pattern.md)
23
- * [EMA Analysis](ema analysis.md)
24
- * [Fibonacci Retracement](fibonacci retracement.md)
25
- * [Head and Shoulders Pattern](head and shoulders pattern.md)
26
- * [Identify Wave Condition](identify wave condition.md)
27
- * [MACD](macd.md)
28
- * [Mean Reversion](mean reversion.md)
29
- * [Momentum](momentum.md)
30
- * [RSI](rsi.md)
31
- * [Simple Moving Average](simple moving average.md)
32
- * [Stochastic Oscillator](stochastic oscillator.md)
33
- * [True Range](true range.md)
19
+ 3. **Facebook's IPO, 2012:** During the initial public offering of Facebook on May 18, 2012, the stock exchange NASDAQ experienced significant technical problems. The defective technology running NASDAQ’s trading software resulted in a delay of the start of trading and confusion over individual share orders, leading to a chaotic and disorderly start to Facebook's life as a public company.
20
+
21
+ 4. **Swiss Franc Surge, 2015:** On January 15, 2015, the Swiss franc surged nearly 30% in a matter of minutes after the Swiss National Bank unexpectedly abolished a cap on the franc's value against the euro. Many automated trading systems were not equipped to handle this abrupt change, resulting in massive losses for many traders and companies.
22
+
23
+ These events highlight the importance of careful design and rigorous testing for trading algorithms and software systems. They also demonstrate the potential for extreme market volatility in the face of unforeseen software failures or unexpected economic events.
24
+
25
+ ## How to be a Winner
26
+
27
+ **Knowledge is King** at the casino when playing blackjack, if you can count the cards without getting caught and killed, you can gain a very small advantage over the house. I was once given the advice to never trade a company that I did not know inside and out or in an industry in which I had no expertise. Basically the more you know about a company the better your chances of making a beneficial trade. I guess the extreme of that is being an insider; but there are laws against that right? Or is it like blackjack and you should just not get caught?
28
+
29
+ Is it possible to "beat the system?" Lots of people have become wealthy selling books or services that purport to teach you how. They all contain the same or similar disclaimers:
30
+
31
+ > Decisions to buy, sell, hold or trade in securities, commodities and other investments involve risk and are best made based on the advice of qualified financial professionals. Any trading in securities or other investments involves a risk of substantial losses.
32
+ >
33
+ > Before undertaking any trading program, you should consult a qualified financial professional. Please consider carefully whether such trading is suitable for you in light of your financial condition and ability to bear financial risks. **Under no circumstances shall we be liable** for any loss or damage you or anyone else incurs as a result of any trading or investment activity that you or anyone else engages in based on any information or material you receive through us or our services.
34
+
35
+ Here's my favorite:
36
+
37
+ > Hypothetical performance results have many inherent limitations. No representation is being made that any account will or is likely to achieve profits or losses similar to those shown. In fact, there are frequently sharp differences between hypothetical performance results and actual results subsequently achieved by any particular trading program.
38
+ >
39
+ > One of the limitations of hypothetical performance results is that they are generally prepared with the benefit of hindsight. In addition, hypothetical trading does not involve financial risk and no hypothetical trading record can completely account for the impact of financial risk in actual trading. For example the ability to withstand losses or to adhere to a particular trading program in spite of the trading losses are material points, which can also adversely affect trading results. There are numerous other factors related to the market in general or to the implementation of any specific trading program which cannot be fully accounted for in the preparation of hypothetical performance results and all of which can adversely affect actual trading results.
40
+
41
+ So it other words "you pays your money and you takes your chances."
42
+
43
+ **The House Always Wins**
@@ -0,0 +1,33 @@
1
+ # Indicators
2
+
3
+ An indicator is a formula/metric on a stock's historical activity. It is presumed to be a forecast as to what the stock activity might be in the future. A single indicator is not necessarily an accurate predictor of future events not is any specific group of indicators.
4
+
5
+ In other words the future is uncertain. Is it a coin flip? Heads the stock's price goes up. Tails, the stock's price goes down. Its one or the other right? What if the price never changes. Then its not a coin flip. Also what is the time frame involved in the forecast? Is it tomorrow, next week, next month, next year, next decade? What is the delta change in price that can be expected?
6
+
7
+ So indicators are like TV weather forecastors. Sometimes they are right. Sometimes they are wrong.
8
+
9
+ We are dealing with uncertainity. In uncertainity there is chaos. If it is possible to be right more times that you are wrong you can make money. If you are always wrong then always do the opposite and you will make money. When you are wrong more times than you are right.... you loose.
10
+
11
+ Its a game. Game theory tells us that there are winners and losers. Bookies at the track make money every day by taking a cut of the losers loses before giving them to the winners. Bookies always win so long as they keep their books balanced. Accounts are important.
12
+
13
+ Back to indicators. Here is a list of the current indicators:
14
+
15
+
16
+
17
+ * [Average True Range](average true range.md)
18
+ * [Bollinger Bands](bollinger bands.md)
19
+ * [Vandlestick Pattern Recognizer](candlestick pattern recognizer.md)
20
+ * [Vlassify Market Profile](classify market profile.md)
21
+ * [Donchian Channel](donchian channel.md)
22
+ * [Double Top Bottom Pattern](double top bottom pattern.md)
23
+ * [EMA Analysis](ema analysis.md)
24
+ * [Fibonacci Retracement](fibonacci retracement.md)
25
+ * [Head and Shoulders Pattern](head and shoulders pattern.md)
26
+ * [Identify Wave Condition](identify wave condition.md)
27
+ * [MACD](macd.md)
28
+ * [Mean Reversion](mean reversion.md)
29
+ * [Momentum](momentum.md)
30
+ * [RSI](rsi.md)
31
+ * [Simple Moving Average](simple moving average.md)
32
+ * [Stochastic Oscillator](stochastic oscillator.md)
33
+ * [True Range](true range.md)
@@ -0,0 +1,233 @@
1
+ # Terms of Use, Policies and Disclaimers
2
+
3
+ **Some sections of these Terms of Use are aspirational. If found to be so, they shall not invalidate any other section which shall remain in full force.**
4
+
5
+ Your affirmative act of using our Ruby Gem ("library") located at https://github.com/MadBomber/sqa (and all associated sites) or services ("SQA") signifies that you agree to the following terms and conditions of use ("Terms of Use"). If you do not agree, do not use SQA. SQA is the property of its author ("us", "we" or "our").
6
+
7
+ **SQA may update these Terms of Use at any time**
8
+
9
+ <!-- Tocer[start]: Auto-generated, don't remove. -->
10
+
11
+ ## Table of Contents
12
+
13
+ - [1. Changes to the terms of use](#1-changes-to-the-terms-of-use)
14
+ - [2. Changes to SQA](#2-changes-to-sqa)
15
+ - [3. Ownership of information; License to use SQA; redistribution of data](#3-ownership-of-information-license-to-use-sqa-redistribution-of-data)
16
+ - [4. Attribution](#4-attribution)
17
+ - [5. Third party sites and advertisers](#5-third-party-sites-and-advertisers)
18
+ - [6. Disclaimer regarding content](#6-disclaimer-regarding-content)
19
+ - [7. Disclaimer regarding investment decisions and trading](#7-disclaimer-regarding-investment-decisions-and-trading)
20
+ - [8. Disclaimer regarding hypothetical performance results](#8-disclaimer-regarding-hypothetical-performance-results)
21
+ - [9. Registered users](#9-registered-users)
22
+ - [10. Non-Professional subscriber status](#10-non-professional-subscriber-status)
23
+ - [11. Derived Data](#11-derived-data)
24
+ - [12. Access and security](#12-access-and-security)
25
+ - [13. Payment and cancellation of service](#13-payment-and-cancellation-of-service)
26
+ - [14. Apple App Store subscriptions](#14-apple-app-store-subscriptions)
27
+ - [15. Android app subscriptions](#15-android-app-subscriptions)
28
+ - [16. Feedback to SQA](#16-feedback-to-sqa)
29
+ - [17. Indemnity](#17-indemnity)
30
+ - [18. Termination](#18-termination)
31
+ - [19. Emails](#19-emails)
32
+ - [20. House rules](#20-house-rules)
33
+ - [21. Third Party Software](#21-third-party-software)
34
+ - [22. Scripts](#22-scripts)
35
+ - [23. Publications - No Recommendation or Advice Status](#23-publications---no-recommendation-or-advice-status)
36
+
37
+ <!-- Tocer[finish]: Auto-generated, don't remove. -->
38
+
39
+ ## 1. Changes to the terms of use
40
+
41
+ We may change these Terms of Use at any time. If you continue to use SQA after we post changes to these Terms of Use, you are signifying your acceptance of the new terms. You will always have access to our Terms of Use and will be able to check it at any time. By reloading [this page](https://github.com/MadBomber/sqa/blob/main/docs/terms_of_use.md), you will have the most up-to-date version available to SQA users.
42
+
43
+ ## 2. Changes to SQA
44
+
45
+ We may discontinue or change any service or feature of SQA at any time without notice. We do not guarantee backward compatibility of our services and Application Programming Interface (API) in this case.
46
+
47
+ ## 3. Ownership of information; License to use SQA; redistribution of data
48
+
49
+ Unless otherwise noted, all rights, titles, and interests in SQA, and all information made available through SQA or our services, in all languages, formats, and media throughout the world, including, but not limited to, all copyrights and trademarks therein, are the exclusive property of SQA, our affiliates or our Data Providers, as defined in section 6 (disclaimer regarding content) below.
50
+
51
+ The content on the SQA platform, including market data and other information, is made available for display purposes only within the website's or mobile app's user interface. Our licensing arrangements with Data Providers do not permit the downloading, sublicensing, assigning, transferring, selling, loaning, or distribution of SQA content for payment without obtaining prior written consent from SQA. Users are required to respect these terms, as they are designed to protect the interests of SQA, its data providers, and its user community, ensuring a secure and reliable platform for all.
52
+
53
+ Breaching these requirements may result in serious consequences, including the blocking of the user or visitor, termination of their account, and potential penalties. SQA also reserves the right to take appropriate legal actions against users found to be in violation of these terms, in order to protect the platform's integrity and the interests of its data providers and user community.
54
+
55
+ Except as otherwise expressly permitted by the preceding paragraphs, you agree not to sell any of the services or materials in any manner or for any purposes, without the prior expressed written consent of SQA and/or our Data Providers. In addition, you shall not, without the prior expressed written consent of SQA and the relevant Data Providers, make copies of any of the software or documentation that may be provided, electronically or otherwise, including, but not limited to, translating, decompiling, disassembling or creating derivative works.
56
+
57
+ Except as otherwise expressly permitted by additional agreement, we do not permit commercial usage of any of our services or APIs. We make no warranty and assume no obligation or liability for third party services or software. Please see section 21 (third party software) below for further information.
58
+
59
+ For additional information on commercial and partnership inquiries with us, please see the Contacts page.
60
+
61
+ ## 4. Attribution
62
+
63
+ SQA grants all users of SQA, and all other available versions of the site, to use snapshots of SQA charts in analysis, press releases, books, articles, blog posts and other publications. In addition, SQA grants the use of all previously mentioned materials in education sessions, the display of SQA charts during video broadcasts, which includes overviews, news, analytics and otherwise use or promote SQA charts or any products from the SQA website on the condition that SQA attribution is clearly visible at all times when such charts and products are used.
64
+
65
+ Attribution must include a reference to SQA, including, but not limited to, those described herein.
66
+
67
+ Use of SQA charts during video or other promotions where SQA attribution is not visible, must include a description of the product used therein. For instance: "Charting platform used for this analysis is provided by SQA," or simply "Charts by SQA." Font size should not be less than 10 PT = 13PX = 3.4MM.
68
+
69
+ You can use the "Snapshot" button in the top toolbar of the chart to instantly create a picture file of your current chart. SQA will automatically take a snapshot with all required attributions and provide a link where you can view your chart, download it or share it. The use of any SQA products outside the SQA website, without a proper attribution of SQA, is not allowed. This extends to any tools (such as widgets) obtained on the SQA website and utilized on the outside resources, where attribution should remain as was originally designed and intended. Users who disobey this attribution rule herein may be banned permanently, and other legal actions may be taken to ensure compliance. This includes, but is not limited to, cease-and-desist warnings, court orders, injunctions, fines, damages relief, and so on.
70
+
71
+ ## 5. Third party sites and advertisers
72
+
73
+ SQA may include links to third party websites. Some of these sites may contain materials that are objectionable, unlawful, or inaccurate. You agree that SQA shall not be held liable for any trading activities or other activities that occur on any website you access through links on SQA. We provide these links as a convenience, and do not endorse the content or services offered by these other sites. Any dealings that you have with advertisers found on SQA are between you and the advertiser and you acknowledge and agree that we are not liable for any loss or claim you may have against an advertiser.
74
+
75
+ Unauthorized soliciting on SQA is strictly prohibited and may result in penalties, including, but not limited to, temporary or permanent bans of the account found in violation, and any appropriate and available legal action for monetary and other damages.
76
+
77
+ ## 6. Disclaimer regarding content
78
+
79
+ SQA cannot and does not represent or guarantee that any of the information available through our services or in SQA is accurate, reliable, current, complete or appropriate for your needs. Various information available through our services or on SQA may be specially obtained by SQA from professional businesses or organizations, such as exchanges, news providers, market data providers and other content providers (e.g. Cboe One and possibly other established financial exchanges such as the New York Stock Exchange, NASDAQ, New York Mercantile Exchange and Dow Jones), who are believed to be sources of reliable information (collectively, the "Data Providers"). Nevertheless, due to various factors — including the inherent possibility of human and mechanical error — the accuracy, completeness, timeliness, results obtained from use, and correct sequencing of information available through our services and website are not and cannot be guaranteed by SQA. We make no warranty and assume no obligation or liability for scripts, indicators, ideas and other content of third parties. Your use of any third-party scripts, indicators, ideas and other content is at your sole risk.
80
+
81
+ ## 7. Disclaimer regarding investment decisions and trading
82
+
83
+ Decisions to buy, sell, hold or trade in securities, commodities and other investments involve risk and are best made based on the advice of qualified financial professionals. Any trading in securities or other investments involves a risk of substantial losses. The practice of "Day Trading" involves particularly high risks and can cause you to lose substantial sums of money. Before undertaking any trading program, you should consult a qualified financial professional. Please consider carefully whether such trading is suitable for you in light of your financial condition and ability to bear financial risks. Under no circumstances shall we be liable for any loss or damage you or anyone else incurs as a result of any trading or investment activity that you or anyone else engages in based on any information or material you receive through SQA or our services.
84
+
85
+ ## 8. Disclaimer regarding hypothetical performance results
86
+
87
+ Hypothetical performance results have many inherent limitations, some of which are mentioned below. No representation is being made that any account will or is likely to achieve profits or losses similar to those shown. In fact, there are frequently sharp differences between hypothetical performance results and actual results subsequently achieved by any particular trading program.
88
+
89
+ One of the limitations of hypothetical performance results is that they are generally prepared with the benefit of hindsight. In addition, hypothetical trading does not involve financial risk and no hypothetical trading record can completely account for the impact of financial risk in actual trading. For example the ability to withstand losses or to adhere to a particular trading program in spite of the trading losses are material points, which can also adversely affect trading results. There are numerous other factors related to the market in general or to the implementation of any specific trading program which cannot be fully accounted for in the preparation of hypothetical performance results and all of which can adversely affect actual trading results.
90
+
91
+ ## 9. Registered users
92
+
93
+ Certain services, such as saving charts, publishing them or the ability to comment on published charts, are available only to registered users of the SQA website and require you to sign in with a username and password to use them. If you register as a user (a "Subscriber") of any of the features of SQA, during the registration process you may be prompted to click "Register Now", "Submit" or a similar button; your clicking on such button will further confirm your agreement to be legally bound by these Terms of Use.
94
+
95
+ In consideration of your use of SQA, you represent that you are of legal age to form a binding contract and are not a person barred from receiving SQA services under the laws of the United States or other applicable jurisdiction. You also agree to: (a) provide true, accurate, current and complete information about yourself as prompted by the SQA's registration form (the "Registration Data") and (b) maintain and promptly update the Registration Data to keep it true, accurate, current and complete. If you provide any information that is untrue, inaccurate, not current or incomplete, or SQA has reasonable grounds to suspect that such information is untrue, inaccurate, not current or incomplete, SQA has the right to suspend or terminate your account and refuse any and all current or future use of the SQA services (or any portion thereof).
96
+
97
+ You represent and warrant that you have all intellectual property rights, including all necessary patent, trademark, trade secret, copyright or other proprietary rights, in and to your content. If you use third-party materials, you represent and warrant that you have the right to distribute third-party material in the content. You agree that you will not submit material that is copyrighted, protected by trade secret or otherwise subject to third party proprietary rights, including patent, privacy and publicity rights, unless you are the owner of such rights or have permission from their rightful owner to submit the material.
98
+
99
+ We may remove your content without notice if we reasonably believe that you're in violation of our Terms of Use.
100
+
101
+ ## 10. Non-Professional subscriber status
102
+
103
+ As a vendor of official real-time market data from exchanges (e.g. Nasdaq) for end users, we are required to identify the status of any Subscriber. If you are ordering a subscription for market data on SQA as the 'Non-Professional', you confirm the following:
104
+
105
+ * You use market data solely for personal use, not for your business or any other entity.
106
+ * You are not registered or qualified with the Securities Exchange Commission (SEC) or the Commodities Futures Trading Commission (CFTC).
107
+ * You are not registered or qualified with any securities agency, any securities exchange, association or regulatory body in any country.
108
+ * You do not perform any functions that are similar to those that require an individual to register or qualify with the SEC, the CFTC, any other securities agency, any securities exchange, or association or regulatory body, or any commodities or futures contract market, or association or regulatory body.
109
+ * You are not engaged as an investment advisor (as that term is defined in Section 202 (a) (11) of the Investment Advisor's Act of 1940) or asset manager and you are not engaged to provide investment advice to any individual or entity.
110
+ * You are not subscribing to the service in your capacity as a principal, officer, partner, employee, or agent of any business or on behalf of any other individual.
111
+ * You use your own capital, not provided by any other individual or entity in the conduct of your trading.
112
+ * You do not conduct trading for the benefit of a corporation, partnership, or other entity.
113
+ * You have not entered into any agreement to share the profit of your trading activities or receive compensation for your trading activities.
114
+ * You are not receiving office space, and equipment or other benefits in exchange for your trading or work as a financial consultant to any person, firm or business entity.
115
+
116
+ Should we, or our exchange partners, determine — based on the information provided and / or companies websites, email address and domain, LinkedIn, regulatory or company registries, payment method — that you actually meet the criteria for a 'Professional' status at any point during or after subscribing to SQA or to market data from exchanges, you will be liable for the difference between the 'Non-Professional' and 'Professional' subscription rates for both SQA subscription and relevant market data. This applies retroactively from the date you initiated your subscription. Furthermore, we reserve the right to automatically invoice you for this difference and charge the associated amount to your on-file payment method.
117
+
118
+ ## 11. Derived Data
119
+
120
+ Our proprietary derivation consumes raw market data and executes a 2-factor derivation process to produce the displayed price, later consumed by the price engine. Derived market data is sourced and supplied from various sources and can therefore be blended.
121
+
122
+ The derivation process involves changing the raw price by a factor determined by the volume of trading on the underlying market, a randomized variable and a maximum offset amount. The derived data price is only ever displayed to our non-professional clients, the derived data price then being the proprietary value of an organization.
123
+
124
+ At no point is raw data accessible by any client, nor can said data be reverse-engineered in any manner. All markets are passed through the same derivation engine.
125
+
126
+ ## 12. Access and security
127
+
128
+ You accept responsibility for the confidentiality and use of any username and email address that use to register for your access to and use of our services. You are responsible for maintaining the confidentiality of your password and account and are fully responsible for all activities that occur under your password or account. You agree to (a) immediately notify SQA of any unauthorized use of your password or account or any other breach of security, and (b) ensure that you exit from your account at the end of each session. SQA cannot and will not be liable for any loss or damage arising from your failure to comply.
129
+
130
+ SQA considers private information on the site (source code of protected or invite-only scripts, etc.) to be confidential to you. SQA protects such private information from unauthorized use, access, or disclosure in the same manner that it protects personal data (please refer to our Privacy Policy for more information).
131
+
132
+ ## 13. Payment and cancellation of service
133
+
134
+ By ordering any subscription on www.SQA.com (including a free trial period) you confirm that you have read and accepted our Terms of Use and you authorize SQA to automatically charge your bank card or PayPal account according to the billing period manually selected by you.
135
+
136
+ Each user can try selected paid plans for 30 days free of charge. If the trial is not cancelled before its expiration date, it automatically converts to a monthly or annual paid plan depending on user’s choice. There are no refunds for monthly plans, even if the subscription is canceled on the same day as the autoconversion payment has gone through. Refunds are available only after an automatic deduction for annual payments (i.e. after trial and after renewal) within 14 calendar days after the payment was made. Please note that users who filed a chargeback/dispute request or a claim are not eligible for a refund. Essential, Plus and Premium subscriptions automatically include market data that is available without additional per-user fees only. You can see which markets are available for free and which need to be purchased separately on the SQA GoPro page. A cancelled trial and associated services will stop immediately after cancellation, except for any data packages that were purchased.
137
+
138
+ The service is billed in advance on a monthly, annual, or 2-year basis. There will be no refunds or credits for partial months of service, or refunds for months unused with an open user account. If auto renewal fails for an annual plan you will automatically be switched to a monthly plan.
139
+
140
+ All billing is recurring, which means you will continue to get billed until you cancel your subscription. You are solely responsible for properly canceling your SQA subscription. An email request or support ticket asking for your subscription to be cancelled is not considered cancellation. You may cancel your subscription at any time by visiting the billing section of your Profile Settings page.
141
+
142
+ If you cancel the service before the end of your current paid up period, your subscription will remain active until the next due date. After the due date, if no payment received, your subscription will be stopped.
143
+ We do not offer refunds for initial payments. If you order the service for the first time, please make sure that the order is correct before the payment is made.
144
+
145
+ We do not offer refunds for recurring monthly payments. If you have been billed for automatic monthly renewal of the Service, you can cancel the subscription to avoid billing for next months.
146
+
147
+ We do not offer refunds for upgrades to a more expensive plan or a longer billing cycle. Remaining days are converted into an equivalent value of days on the new subscription.
148
+
149
+ We offer refunds for recurring annual and 2-year payments on demand. If you have been billed for automatic annual and 2-year renewal of the service, you have 14 calendar days (after the payment was made) to contact our support team. If you don't do this, SQA assumes that renewal of the service is expected and the payment will not be refunded.
150
+
151
+ Refunds are available only after an automatic deduction for annual payments (i.e. after trial and after renewal) within 14 calendar days after the payment was made.
152
+ Our moderators are official SQA representatives, with the authority to warn or ban users (including those with a paid subscription) when they do not abide by the House Rules. We do not offer refunds in case you are banned from publishing content and interacting with others because your paid subscription and all of its data and/or features are still available during any such ban.
153
+
154
+ SQA is registered for tax purposes in Australia, Canada, Colombia, EU states, Japan, India, Indonesia, Iceland, Liechtenstein, Malaysia, Mexico, New Zealand, Norway, Saudi Arabia, Singapore, South Africa, South Korea, Switzerland, Taiwan, Thailand, Turkey, United Arab Emirates, United Kingdom, Vietnam, certain US states and cities.
155
+
156
+ SQA may use local subsidiaries or other entities to collect payments in certain geographies. However, all payments will be processed and managed by SQA, and the service will be provided by SQA, Inc., regardless of which entity collects the payment.
157
+
158
+ ## 14. Apple App Store subscriptions
159
+
160
+ Payments will be charged to the user's Apple ID Account at confirmation of purchase in compliance with Apple's privacy policy. We recommend that you familiarize yourself with the terms of payment and Apple in-app subscriptions. If a purchase is made from our iOS app, the refund is only possible in compliance with the App Store policy.
161
+
162
+ SQA offers a trial period. It is only possible to use the trial period once. Subscription payment begins after the end of your free trial period.
163
+
164
+ All subscription types are renewed automatically. You can cancel the renewal option in the App Store within at least 24 hours before the end of your free trial period or the current payment date. The cancellation comes into effect at the end of the current billing period. At the same time, you retain access to the subscription from the cancellation moment until the end of the current billing period.
165
+
166
+ Accounts may be charged for renewal up to 24 hours before the end of the current period.
167
+
168
+ Rates offered in mobile stores and on the web-based platform might differ. Mobile stores offer subscriptions based on two billing cycles: annual and monthly.
169
+
170
+ ## 15. Android app subscriptions
171
+
172
+ Financial transactions for subscriptions made in our Android app processed by a third-party service (Google Play) in compliance with their terms of use, privacy policy and any applicable payment terms, in particular the response on Google Play refunds. SQA is not responsible for the actions or omissions of any third-party payment processor. We recommend that you familiarize yourself with the terms of payment and Google Play in-app subscriptions. If a purchase is made from our Android app, the refund is only possible in compliance with Google Play policy.
173
+
174
+ SQA offers a trial period. It is only possible to use the trial period once. Subscription payment begins after the end of your free trial period.
175
+ All subscription types are renewed automatically. You can cancel the renewal option in Google Play within at least 24 hours before the end of your free trial period or the current payment date. The cancellation comes into effect at the end of the current billing period. At the same time, you retain access to the subscription from the cancellation moment until the end of the current billing period.
176
+
177
+ The payment is made according to the payment method that is linked to the user's account in Google Play. The subscription is made according to Google Play Account choice, which does not necessarily conform with the Google Account used to log in to the application.
178
+
179
+ Rates offered in mobile stores and on the web-based platform might differ. Mobile stores offer subscriptions based on two billing cycles: annual and monthly.
180
+
181
+ ## 16. Feedback to SQA
182
+
183
+ By submitting ideas, content, suggestions, documents, and/or proposals ("Contributions") to SQA through our contact or feedback processes, you acknowledge and agree that: (a) your Contributions do not contain confidential or proprietary information; (b) SQA is not under any obligation of confidentiality, expressed or implied, with respect to the Contributions; (c) SQA shall be entitled to use or disclose (or choose not to use or disclose) such Contributions for any purpose, in any way, in any media worldwide; (d) SQA may have something similar to the Contributions already under consideration or in development; (e) your Contributions automatically become the property of SQA, without any obligation of SQA to you; and (f) you are not entitled to any compensation or reimbursement of any kind from SQA under any circumstances.
184
+
185
+ ## 17. Indemnity
186
+
187
+ You agree to indemnify and hold SQA and our subsidiaries, affiliates, officers, agents, employees, partners and licensors harmless from any claim or demand, including reasonable attorneys' fees, made by any third party due to or arising out of content you submit, post, transmit, modify or otherwise make available through the SQA services, your use of the SQA services, your connection to the SQA services, your violation of the Terms of Use, or your violation of any rights of another.
188
+
189
+ ## 18. Termination
190
+
191
+ Upon your request, your account can be deleted from SQA. You may delete your account at any time by visiting your Profile Settings page. If you requested your account be deleted, we will delete the personal data associated with your account, however certain personal data will be retained if it has been integrated into data that is integral to our systems and site, including data in communications you have sent via our site. This data is necessarily retained for the integrity of the data on the site and our legitimate business purposes, including auditing, security and other legitimate interests (please refer to our Privacy Policy for more information). Your published Contributions will remain on the site in our discretion. Once a Contribution has been published, it becomes part of the communal trading knowledge and should stay that way. This policy prevents users from keeping only their best ideas public, thus keeping everyone honest and maintaining public confidence in the reputation and integrity of the site.
192
+
193
+ You agree that SQA may, without prior notice, immediately terminate, limit your access to or suspend your SQA account, any associated email address, and access to the SQA services. Cause for such termination, limitation of access or suspension shall include, but not be limited to, (a) breaches or violations of the Terms of Use or other incorporated agreements or guidelines, (b)requests by law enforcement or other government agencies, (c) discontinuance or material modification to the SQA services (or any part thereof), (d) unexpected technical or security issues or problems, (e) extended periods of inactivity, (f) and/or engagement by you in fraudulent or illegal activities. Further, you agree that all terminations, limitations of access and suspensions for cause shall be made in SQA's sole discretion and that SQA shall not be liable to you or any third party for any termination of your account, any associated email address, or access to the SQA services.
194
+
195
+ ## 19. Emails
196
+
197
+ By creating an account with SQA, you agree that SQA can use your email address to send you marketing materials, service-related notices, important information messages, special offers, etc. You can unsubscribe from this by clicking on the link provided in the emails.
198
+
199
+ ## 20. House rules
200
+
201
+ By creating and using an account on SQA you confirm you have read and agree to follow our House Rules.
202
+
203
+ ## 21. Third Party Software
204
+
205
+ Our software, website and/or services may include software components supplied by third parties which are utilized by permission of the respective licensors and/or copyright holders on the terms provided by such parties ("Third Party Software"). SQA expressly disclaims any warranty or other assurance to you regarding Third Party Software. Please note that your use of the Third Party Software will be governed by the terms and conditions of use and privacy policies of the Third Party Software providers and not by these Terms of Use or our Privacy Policy.
206
+
207
+ ## 22. Scripts
208
+
209
+ You represent and warrant that you have all intellectual property rights, including all necessary patent, trademark, trade secret, copyright or other proprietary rights, in and to your script. If you use third-party materials, you represent and warrant that you have the right to distribute third-party material in the script. You agree that you will not submit material that is copyrighted, protected by trade secret or otherwise subject to third party proprietary rights, including patent, privacy and publicity rights, unless you are the owner of such rights or have permission from their rightful owner to submit the material.
210
+
211
+ You are solely responsible for any script that you create. SQA is not in any way responsible for the use or misuse of your script by any user. SQA is not in any way responsible for the use or misuse of any user’s script by you.
212
+
213
+ By using the publish script feature, you grant us a world-wide, irrevocable, perpetual, royalty-free license to:
214
+
215
+ * publish this script as well as the username of the author;
216
+ * disclose the source code of the script for open scripts;
217
+ * perform, display, use and make available your open or protected script for any user or an invite-only script for any user that received an invite.
218
+
219
+ We may remove your script without notice if we reasonably believe that you are in violation of these Terms of Use.
220
+
221
+ You can publish the script under any license. If you do not include the license in the comment section of a script, you agree that your script is licensed under the Mozilla Public License 2.0.
222
+
223
+ ## 23. Publications - No Recommendation or Advice Status
224
+
225
+ The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by SQA.
226
+
227
+ Any statement of view (which may be subject to change without notice) is the author's personal opinion, and the author makes no representations or warranties as to the accuracy or completeness of any information or analysis provided.
228
+
229
+ The authors and SQA are not liable for any losses incurred as a result of any investment made on the basis of any perceived recommendation, forecast, or other information presented here.
230
+
231
+ The contents of these publications should not be interpreted as an express or implicit promise, guarantee, or indication by SQA that customers will profit or that losses in connection with them can or will be limited if they rely on the information provided.
232
+
233
+ **SQA may update these Terms of Use at any time**
@@ -1,6 +1,12 @@
1
1
  # lib/sqa/data_frame/yahoo_finance.rb
2
2
  # frozen_string_literal: true
3
3
 
4
+ =begin
5
+ The website financial.yahoo.com no longer supports an API.
6
+ To get recent stock historical price updates you have
7
+ to scrape the webpage.
8
+ =end
9
+
4
10
 
5
11
  class SQA::DataFrame
6
12
  class YahooFinance
@@ -26,30 +26,39 @@ class SQA::DataFrame
26
26
  # mapping is a Hash { old_key => new_key }
27
27
  # transformers is also a Hash { key => Proc}
28
28
  def initialize(
29
- aofh_or_hofa= {}, # Array of Hashes or hash of array or hash
29
+ raw_data= {}, # Array of Hashes or hash of array or hash
30
30
  mapping: {}, # { old_key => new_key }
31
31
  transformers: {} # { key => Proc }
32
32
  )
33
33
 
34
- if aofh_or_hofa.is_a? Hash
35
- initialize_hofa(aofh_or_hofa, mapping: mapping)
34
+ if raw_data.is_a? Hash
35
+ initialize_hofa(raw_data, mapping: mapping)
36
36
 
37
- elsif aofh_or_hofa.is_a?(Array) &&
38
- aofh_or_hofa.first.is_a?(Hash)
39
- initialize_aofh(aofh_or_hofa, mapping: mapping)
37
+ elsif raw_data.is_a?(Array) &&
38
+ raw_data.first.is_a?(Hash)
39
+ initialize_aofh(raw_data, mapping: mapping)
40
40
 
41
41
  else
42
42
  raise BadParameterError, "Expecting Hash or Array of Hashes got: #{aofh_or_hofa.class}"
43
43
  end
44
44
 
45
- coerce_vectors!(transformers) unless transformers.empty?
45
+ coerce_vectors!(transformers) if good_data? && !(transformers.nil? || transformers.empty?)
46
+ end
47
+
48
+
49
+ def good_data?
50
+ return false if @data.empty? || @data.values.all?{|v| v.nil? || v.empty?}
51
+
52
+ true
46
53
  end
47
54
 
48
55
 
49
56
  def initialize_aofh(aofh, mapping:)
50
- hofa = self.class.aofh_to_hofa(
57
+ klass = self.class
58
+
59
+ hofa = klass.aofh_to_hofa(
51
60
  aofh,
52
- mapping: mapping
61
+ mapping: mapping
53
62
  )
54
63
 
55
64
  initialize_hofa(hofa, mapping: mapping)
@@ -57,7 +66,8 @@ class SQA::DataFrame
57
66
 
58
67
 
59
68
  def initialize_hofa(hofa, mapping:)
60
- hofa = self.class.normalize_keys(
69
+ klass = self.class
70
+ hofa = klass.normalize_keys(
61
71
  hofa,
62
72
  adapter_mapping: mapping
63
73
  ) unless mapping.empty?
@@ -283,7 +293,7 @@ class SQA::DataFrame
283
293
  end
284
294
  end
285
295
 
286
- # SMELL: This might be necessary
296
+ # SMELL: This might not be necessary
287
297
  normalize_keys(hofa, adapter_mapping: mapping)
288
298
  end
289
299
 
@@ -291,13 +301,14 @@ class SQA::DataFrame
291
301
  def normalize_keys(hofa, adapter_mapping: {})
292
302
  hofa = rename(adapter_mapping, hofa)
293
303
  mapping = generate_mapping(hofa.keys)
304
+
294
305
  rename(mapping, hofa)
295
306
  end
296
307
 
297
308
 
298
309
  def rename(mapping, hofa)
299
310
  mapping.each_pair do |old_key, new_key|
300
- hofa[new_key] = hofa.delete(old_key)
311
+ hofa[new_key] = hofa.delete(old_key) if hofa.has_key?(old_key)
301
312
  end
302
313
 
303
314
  hofa
data/lib/sqa/stock.rb CHANGED
@@ -101,7 +101,7 @@ class SQA::Stock
101
101
  return if df2.nil? # CSV file is up to date.
102
102
 
103
103
  df_nrows = @df.nrows
104
- @df.append(df2)
104
+ @df.append!(df2)
105
105
 
106
106
  if @df.nrows > df_nrows
107
107
  @df.to_csv(@df_path)
data/lib/sqa/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SQA
4
- VERSION = "0.0.20"
4
+ VERSION = "0.0.22"
5
5
 
6
6
  class << self
7
7
  def version
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sqa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.20
4
+ version: 0.0.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dewayne VanHoozer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-23 00:00:00.000000000 Z
11
+ date: 2023-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: alphavantage
@@ -192,6 +192,20 @@ dependencies:
192
192
  - - ">="
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0'
195
+ - !ruby/object:Gem::Dependency
196
+ name: tocer
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ version: '0'
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
195
209
  - !ruby/object:Gem::Dependency
196
210
  name: rake
197
211
  requirement: !ruby/object:Gem::Requirement
@@ -215,6 +229,7 @@ executables:
215
229
  extensions: []
216
230
  extra_rdoc_files: []
217
231
  files:
232
+ - ".config/tocer/configuration.yml"
218
233
  - ".envrc"
219
234
  - CHANGELOG.md
220
235
  - LICENSE
@@ -232,6 +247,8 @@ files:
232
247
  - checksums/sqa-0.0.19.gem.sha512
233
248
  - checksums/sqa-0.0.2.gem.sha512
234
249
  - checksums/sqa-0.0.20.gem.sha512
250
+ - checksums/sqa-0.0.21.gem.sha512
251
+ - checksums/sqa-0.0.22.gem.sha512
235
252
  - checksums/sqa-0.0.3.gem.sha512
236
253
  - checksums/sqa-0.0.4.gem.sha512
237
254
  - checksums/sqa-0.0.5.gem.sha512
@@ -252,6 +269,7 @@ files:
252
269
  - docs/fibonacci_retracement.md
253
270
  - docs/head_and_shoulders_pattern.md
254
271
  - docs/identify_wave_condition.md
272
+ - docs/indicators.md
255
273
  - docs/libsvm_file_format.md
256
274
  - docs/market_profile.md
257
275
  - docs/mean_reversion.md
@@ -264,6 +282,7 @@ files:
264
282
  - docs/simple_moving_average.md
265
283
  - docs/stochastic_oscillator.md
266
284
  - docs/strategy.md
285
+ - docs/terms_of_use.md
267
286
  - docs/true_range.md
268
287
  - lib/patches/string.rb
269
288
  - lib/sqa.rb