コード例 #1
0
        public InstrumentData InstrumentsBySymbol(string symbol)
        {
            var find = new Dictionary <string, string>()
            {
                { "query", symbol }
            };

            return(JsonParse.ParseInstrumentBySymbol(RHttpClient.RHttpClientGetParams("/instruments/", find)));
        }
コード例 #2
0
        public InstrumentData[] InstrumentsByKeyWord(string keyword)
        {
            var find = new Dictionary <string, string>()
            {
                { "query", keyword }
            };

            return(JsonParse.ParseInstrument(RHttpClient.RHttpClientGetParams("/instruments/", find)));
        }
コード例 #3
0
        public Movers[] GetMoversDown()
        {
            Dictionary <string, string> movers = new Dictionary <string, string>
            {
                { "direction", "down" }
            };

            return(JsonParse.ParseMovers(RHttpClient.RHttpClientGetParams("/midlands/movers/sp500/", movers)));
        }
コード例 #4
0
        public FundamentalData[] GatherMultipleFundamentalBySymbol(string[] symbols)
        {
            string[]          content         = new string[symbols.Length];
            FundamentalData[] fundamentalData = new FundamentalData[symbols.Length];
            for (int i = 0; i < symbols.Length; i++)
            {
                content[i]         = RHttpClient.RHttpClientGet("/fundamentals/" + symbols[i] + "/");
                fundamentalData[i] = JsonParse.ParseFundament(content[i]);
            }

            return(fundamentalData);
        }
コード例 #5
0
 public string GatherListofMarkets()
 {
     return(RHttpClient.RHttpClientGet("/markets/"));
 }
コード例 #6
0
 public string GatherMarketInformation(string market)
 {
     return(RHttpClient.RHttpClientGet("/markets/" + market + "/"));
 }
コード例 #7
0
 public static JToken TesterAuthenication(string accessToken, string testPoint)
 {
     return(JToken.Parse(RHttpClient.RHttpClientGetWithAuthenticationHeader(testPoint, accessToken)));
 }
コード例 #8
0
ファイル: Account.cs プロジェクト: karayakar/RobinhoodSharp
 public Dividends[] GatherAccountDividends(string accessToken)
 {
     return(JsonParse.ParseAccountDividends(RHttpClient.RHttpClientGetWithAuthenticationHeader("/dividends/", accessToken)));
 }
コード例 #9
0
ファイル: Account.cs プロジェクト: karayakar/RobinhoodSharp
 public InvestmentProfileData GatherInvestmentProfile(string accessToken)
 {
     return(JsonParse.ParseInvestmentProfile(RHttpClient.RHttpClientGetWithAuthenticationHeader("/user/investment_profile/", accessToken)));
 }
コード例 #10
0
ファイル: Account.cs プロジェクト: karayakar/RobinhoodSharp
 public Employment GatherEmploymentData(string accessToken)
 {
     return(JsonParse.ParseEmployment(RHttpClient.RHttpClientGetWithAuthenticationHeader("/user/employment/", accessToken)));
 }
コード例 #11
0
 public InstrumentData InstrumentsByIDTrim(string id)
 {
     return(JsonParse.ParseInstrumentByID(RHttpClient.RHttpClientGet("/instruments/" + id.Replace("https://api.robinhood.com/instruments/", ""))));
 }
コード例 #12
0
 public InstrumentData InstrumentsByID(string id)
 {
     return(JsonParse.ParseInstrumentByID(RHttpClient.RHttpClientGet("/instruments/" + id + "/")));
 }
コード例 #13
0
ファイル: Quotes.cs プロジェクト: karayakar/RobinhoodSharp
 public QuoteHistory[] GatherHistoryQuotes(string symbol, Dictionary <string, string> parameters)
 {
     return(JsonParse.ParseQuoteHistory(RHttpClient.RHttpClientGetParams("/quotes/historicals/" + symbol + "/", parameters)));
 }
コード例 #14
0
 //Is not available on server
 public string[] Get10MostPopular()
 {
     return(JsonParse.ParsePopular(RHttpClient.RHttpClientGet("/midlands/tags/tag/10-most-popular/"), 10));
 }
コード例 #15
0
ファイル: Account.cs プロジェクト: karayakar/RobinhoodSharp
 public AccountID GatherAccountID(string accessToken)
 {
     return(JsonParse.ParseAccountID(RHttpClient.RHttpClientGetWithAuthenticationHeader("/user/id/", accessToken)));
 }
コード例 #16
0
ファイル: Account.cs プロジェクト: karayakar/RobinhoodSharp
 public AccountAffiliationInfo GatherAccountHolderAffliationInfo(string accessToken)
 {
     return(JsonParse.ParseAccountAffiliationInfo(RHttpClient.RHttpClientGetWithAuthenticationHeader("/user/additional_info/", accessToken)));
 }
コード例 #17
0
 public InstrumentData[] AllInstruments()
 {
     return(JsonParse.ParseAllInstruments(RHttpClient.RHttpClientGet("/instruments/")));
 }
コード例 #18
0
ファイル: Account.cs プロジェクト: karayakar/RobinhoodSharp
 public MarginBalances GatherMarginBalances(string accessToken)
 {
     return(JsonParse.ParseMarginBalances(RHttpClient.RHttpClientGetWithAuthenticationHeader("/accounts/", accessToken)));
 }
コード例 #19
0
 //For the next value
 public InstrumentData[] AllInstruments(string next)
 {
     return(JsonParse.ParseAllInstruments(RHttpClient.RHttpClientGet(next)));
 }
コード例 #20
0
ファイル: Account.cs プロジェクト: karayakar/RobinhoodSharp
 public AccountPosition[] GatherAccountPositions(string accessToken)
 {
     return(JsonParse.ParseAccountPosition(RHttpClient.RHttpClientGetWithAuthenticationHeader("/positions/", accessToken)));
 }
コード例 #21
0
 public SplitData[] GatherSplitHistoryForInstrument(string id)
 {
     return(JsonParse.ParseSplitHistory(RHttpClient.RHttpClientGet("/instruments/" + id + "/splits/")));
 }
コード例 #22
0
ファイル: Account.cs プロジェクト: karayakar/RobinhoodSharp
 public Portfolio GatherAccountPortfolio(string accessToken)
 {
     return(JsonParse.ParseAccountPortfolio(RHttpClient.RHttpClientGetWithAuthenticationHeader("/portfolios/", accessToken)));
 }
コード例 #23
0
 public SplitData GatherSplitHistoryForInstrumentSpecified(string splitId)
 {
     return(JsonParse.ParseSplitHistorySingle(RHttpClient.RHttpClientGet(splitId.Replace("https://api.robinhood.com", ""))));
 }
コード例 #24
0
        static void Main(string[] args)
        {
            Login          login          = new Login();
            Authentication authentication = new Authentication();
            Endpoints      endpoints      = new Endpoints();
            Quotes         quotes         = new Quotes();
            Fundamentals   fundamentals   = new Fundamentals();
            Instruments    instruments    = new Instruments();
            Account        account        = new Account();
            Market         market         = new Market();
            Statistics     statistics     = new Statistics();

            var testDic = new Dictionary <string, string>
            {
                { "query", "Microsoft" }
            };

            using (StreamReader reader = new StreamReader("login.txt"))
            {
                var readFile = reader.ReadToEnd();
                var words    = readFile.Split();
                login.username = words[1];
                login.password = words[4];
            }

            //login.AccessToken = authentication.AuthenticateUser(login,true);
            authentication.ReadAccessToken(login);
            authentication.CheckRefreshToken(login);
            //account.GatherBasicInfo(login.AccessToken);
            //account.GatherAccountID(login.AccessToken);
            //Console.ReadLine();


            var quoteData = quotes.GatherData("GOOGL");

            string[] data = new string[]
            {
                "MSFT",
                "GOOGL",
                "AAPL",
                "AMZN",
                "TSLA"
            };

            var content = fundamentals.GatherMultipleFundamentalBySymbol(data);             //Returns an array of fudamentalData

            for (int i = 0; i < data.Length; i++)
            {
                Console.WriteLine(content[i].description);
                Console.WriteLine(content[i].high);
                Console.WriteLine(content[i].high52Weeks);
                Console.WriteLine(content[i].low);
                Console.WriteLine(content[i].low52Weeks);
                Console.WriteLine(content[i].marketCap + Environment.NewLine);
            }

            InstrumentData[] instrumentData = instruments.InstrumentsByKeyWord("oil");             //Returns an array of "InstrumentData" after querying the Robinhood server
            Console.WriteLine("-----------------------------------Instruments--------------------------");

            foreach (var item in instrumentData)
            {
                Console.WriteLine(item.name);
                Console.WriteLine(item.simpleName);
                Console.WriteLine(item.listDate);
                Console.WriteLine(item.market);
                Console.WriteLine(item.symbol);
                Console.WriteLine(item.country);
                Console.WriteLine("------------------------------------------------------------------------------");
            }
            Console.WriteLine("----------------------------------Instrument by Symbol------------------------------");
            InstrumentData instrument = instruments.InstrumentsBySymbol("MSFT");

            Console.WriteLine(instrument.simpleName);
            Console.WriteLine(instruments.InstrumentsByID("777c0d30-3f78-4449-8d85-49702ae96a34").name);

            Console.WriteLine("----------------------------------ALL------------------------------");
            InstrumentData[] allInstruments = instruments.AllInstruments();
            Console.WriteLine(allInstruments[18].name);
            Console.WriteLine(allInstruments[18].simpleName);
            Console.WriteLine(allInstruments[0].next);

            allInstruments = instruments.AllInstruments("https://api.robinhood.com/instruments/?cursor=cD0xMjk4NQ%3D%3D");
            Console.WriteLine("----------------------------------------------Next Page---------------------------------------");
            Console.WriteLine(allInstruments[0].name);
            Console.WriteLine(allInstruments[0].next);

            Console.WriteLine("----------------------------------------------Splits---------------------------------------");
            SplitData[] splitData = instruments.GatherSplitHistoryForInstrument(instruments.InstrumentsBySymbol("SCO").id);             //Gather information for one instrument split
            //Most times there wont be one
            //SCO just happened to be one that has a split which I used for testing
            Console.WriteLine(splitData[0].executionDate);
            Console.WriteLine(splitData[0].instrument);
            Console.WriteLine(splitData[0].multiplier);
            Console.WriteLine("----------------------------------------------Single Splits Thing---------------------------------------");
            SplitData splitDataSingle = instruments.GatherSplitHistoryForInstrumentSpecified(splitData[0].url);                                         //Single stocks get

            //Get one of the splits information
            Console.WriteLine(splitDataSingle.executionDate);
            Console.WriteLine(splitDataSingle.instrument);

            Console.WriteLine("----------------------------------------------Account---------------------------------------");
            Console.WriteLine(account.GatherListofAccounts(login.AccessToken) + Environment.NewLine);
            Console.WriteLine(account.GatherEmploymentData(login.AccessToken).employerName + Environment.NewLine);
            Console.WriteLine(account.GatherAccountHolderAffliationInfo(login.AccessToken).agreedToRhs + Environment.NewLine);

            Console.WriteLine("----------------------------------------------Account Basic Info---------------------------------------");
            AccountBasicInfo basicInfo = account.GatherBasicInfo(login.AccessToken);

            Console.WriteLine(basicInfo.citizenship);
            Console.WriteLine(basicInfo.countryOfResident);
            Console.WriteLine(basicInfo.phoneNumber);
            Console.WriteLine(basicInfo.state);


            Console.WriteLine("Account Number: " + account.GatherListofAccounts(login.AccessToken).accountNumber);
            Console.WriteLine(account.GatherMarginBalances(login.AccessToken).updatedAt);
            Console.WriteLine("Start of day overnight buying power = " + account.GatherMarginBalances(login.AccessToken).startOfDayOvernightBuyingPower);

            Console.WriteLine("------------------------------------------------------------------------------Investment----------------------------------------------");
            InvestmentProfileData investmentProfileData = account.GatherInvestmentProfile(login.AccessToken);

            Console.WriteLine("Liquid net Worth: " + investmentProfileData.liquidNetWorth);
            Console.WriteLine("Risk Tolerance: " + investmentProfileData.riskTolerance);
            Console.WriteLine("Investment Objective" + investmentProfileData.investmentObjective);
            Console.WriteLine("\n\nAccount Average Buy Price for " + instruments.InstrumentsByID(account.GatherAccountPositions(login.AccessToken)[0].instrument.Replace("https://api.robinhood.com/instruments/", "").TrimEnd('/')).simpleName + ": " + account.GatherAccountPositions(login.AccessToken)[0].averageBuyPrice);
            Console.WriteLine("\n\nAccount Average Buy Price for " + instruments.InstrumentsByID(account.GatherAccountPositions(login.AccessToken)[1].instrument.Replace("https://api.robinhood.com/instruments/", "").TrimEnd('/')).simpleName + ": " + account.GatherAccountPositions(login.AccessToken)[1].averageBuyPrice);
            Console.WriteLine("\n\nAccount Average Buy Price for " + instruments.InstrumentsByID(account.GatherAccountPositions(login.AccessToken)[2].instrument.Replace("https://api.robinhood.com/instruments/", "").TrimEnd('/')).simpleName + ": " + account.GatherAccountPositions(login.AccessToken)[2].averageBuyPrice);

            //interval=year|month|week|day|10minute|5minute|null(all) span=day|week|month|year|5year|all bounds=extended|regular|trading
            //Only day can use the minute intervals
            DateTime time = new DateTime(2018, 12, 12);

            Console.WriteLine(time);
            Console.WriteLine(market.GatherMarketHours("BATS", time));
            var symbol   = Input("Symbol:");
            var interval = Input("Interval:");
            var span     = Input("Span:");
            var bounds   = Input("Bounds:");

            Dictionary <string, string> param = new Dictionary <string, string>
            {
                { "interval", interval },
                { "span", span },
                { "all bounds", bounds }
            };

            QuoteHistory[] quoteHistory = quotes.GatherHistoryQuotes(symbol, param);
            for (int i = 0; i < quoteHistory.Length; i++)
            {
                Console.WriteLine("Open Price:" + quoteHistory[i].openPrice);
                Console.WriteLine("Close Price: " + quoteHistory[i].closePrice);
                Console.WriteLine("Volume: " + quoteHistory[i].volume);
            }
            Console.WriteLine(Environment.NewLine);
            string[] pop = statistics.Get100MostPopular();
            foreach (var item in pop)
            {
                var thing = instruments.InstrumentsByIDTrim(item);
                Console.WriteLine(thing.name + ":" + thing.symbol);
            }

            //Did not implement these
            Console.WriteLine(TesterAuthenication(login.AccessToken, "/settings/notifications/"));
            Console.WriteLine(TesterAuthenication(login.AccessToken, "/notifications/devices/"));
            Console.WriteLine(Environment.NewLine);
            Console.WriteLine(Environment.NewLine);

            //News & Info
            Console.WriteLine(JToken.Parse(RHttpClient.RHttpClientGet("/midlands/news/MSFT/")));             //Need to be implemented
            Console.WriteLine(account.GatherAccountPortfolio(login.AccessToken).extendedHoursMarketValue);

            Console.ReadLine();
        }
コード例 #25
0
 public SplitData GatherSplitHistoryForInstrumentSpecified(string id, string splitId)
 {
     return(JsonParse.ParseSplitHistorySingle(RHttpClient.RHttpClientGet("/instruments/" + id + "/splits/" + splitId + '/')));
 }
コード例 #26
0
 public string GatherMarketHours(string market, DateTime date)
 {
     return(RHttpClient.RHttpClientGet("/markets/" + market + "/hours/" + date.ToString(@"yyyy-MM-dd") + "/"));
 }
コード例 #27
0
ファイル: Account.cs プロジェクト: karayakar/RobinhoodSharp
 public AccountListKeys GatherListofAccounts(string accessToken)
 {
     return(JsonParse.ParseListAccounts(RHttpClient.RHttpClientGetWithAuthenticationHeader("/accounts/", accessToken)));
 }
コード例 #28
0
ファイル: Account.cs プロジェクト: karayakar/RobinhoodSharp
 public AccountBasicInfo GatherBasicInfo(string accessToken)
 {
     return(JsonParse.ParseAccountBasicInfo(RHttpClient.RHttpClientGetWithAuthenticationHeader("/user/basic_info/", accessToken)));
 }
コード例 #29
0
 public string GatherFundamentalBySymbol(string symbol)
 {
     return(RHttpClient.RHttpClientGet("/fundamentals/" + symbol + "/"));
 }