java - double inexing an array without int -
i'm importing historical data many stocks on dates java csv files. goal use program in java built trade (buy , sell) of these tickers on dates. program configured work 1 ticker, want expand work thousands (over thousands of dates).
i have 2 tables, 1 containing ticker , when buy/sell, , other (pictured below) price , historical information. using two, if, in table 1 have indication ticker x on y date, want able sell ticker x when price decreases by, say, 80% purchase price. in order facilitate kind of decision making, each ticker might trade, have historical data ten years. have tens of millions of rows in table two.
i'd able reference each of columns (market cap, p/e ratio, beta...) using ticker , date identifiers. i'd manipulate data in such way (in java) find minimum , maximum of p/e particular ticker on date range.
i thought should create "numeric key" each ticker , date combo. each character in ticker, converted ascii, concatenated, , added date. thought use each 1 of these unique identifier indexing array, realized had no way of figuring out when tickers' data began , when ended.
what data type better suited this?
wouldn't better use hashmap
, key combines ticker , date?
something like:
public class tickerdate { private final string ticker; private final date date; public tickerdate(string ticker, date date) { this.ticker = ticker; this.date = date; } // .. getters // equals + hashcode }
it easier understand in code.
other option use table
guava, won't need write tickerdate
class above.
Comments
Post a Comment