-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
75 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
using System.Net; | ||
using System.Net.Http; | ||
|
||
using Newtonsoft.Json; | ||
|
||
namespace StockScraper | ||
{ | ||
class MdFtx | ||
{ | ||
private static readonly HttpClient _client = new HttpClient(); | ||
public static async Task<Dictionary<string, string>> GetQuoteSummary(string ticker) | ||
{ | ||
// ftx ticker: btc-0924, btc/usd | ||
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; | ||
HttpResponseMessage response = await _client.GetAsync($"https://ftx.com/api/markets/{ticker}"); | ||
|
||
// Read the content. | ||
string responseFromServer = await response.Content.ReadAsStringAsync(); | ||
|
||
// Augment the content. | ||
dynamic obj = JsonConvert.DeserializeObject(responseFromServer); | ||
Dictionary<string, string> quoteSummary; | ||
if (obj.success == true) | ||
{ | ||
var result = obj.result; | ||
quoteSummary = result.ToObject<Dictionary<string, string>>(); | ||
quoteSummary.Add("CURRENT PRICE", quoteSummary["price"]); | ||
} | ||
else | ||
throw new ArgumentException(obj["error"]); | ||
return quoteSummary; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+1.5 KB
(100%)
StockScraper/StockScraper/bin/Debug/StockScraper-AddIn-packed.xll
Binary file not shown.
Binary file modified
BIN
+1.5 KB
(100%)
StockScraper/StockScraper/bin/Debug/StockScraper-AddIn64-packed.xll
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters