lib/tdameritrade_api/price_history.rb
Method get_price_history
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def get_price_history(symbol, options={})
# TODO: allow multiple symbols by allowing user to pass and array of strings
# TODO: change this around so that it does not need a temporary file buffer and can handle the processing in memory
validate_price_history_options options
request_params = build_price_history_request_params(symbol, options)
Method get_quote
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def get_quote(symbols)
if symbols.is_a? Array
quote_list = symbols.join(',') if symbols.is_a? Array
else
quote_list=symbols
Method get_price_history
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
def get_price_history(symbol, options={})
# TODO: allow multiple symbols by allowing user to pass and array of strings
# TODO: change this around so that it does not need a temporary file buffer and can handle the processing in memory
validate_price_history_options options
request_params = build_price_history_request_params(symbol, options)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method build_price_history_request_params
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def build_price_history_request_params(symbol, options)
req = {source: @source_id, requestidentifiertype: 'SYMBOL'}.merge(options)
if symbol.kind_of? String
req[:requestvalue] = symbol
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"