Skip to content

Commit

Permalink
update ticker api, fix okcoin price display issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
philsong committed Mar 31, 2017
1 parent 90402c8 commit 584938e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
10 changes: 5 additions & 5 deletions btcbar/Fetchers/HaobtcCNYFetcher.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ - (id)init
if (self = [super init])
{
// Menu Item Name
self.ticker_menu = @"Haobtc";
self.ticker_menu = @"BiXin";

// Website location
self.url = @"http://k.sosobtc.com/btc_haobtc.html?from=1NDnnWCUu926z4wxA3sNBGYWNQD3mKyes8?from=1NDnnWCUu926z4wxA3sNBGYWNQD3mKyes8";
Expand All @@ -40,7 +40,7 @@ - (void)setTicker:(NSString *)tickerString
// Initiates an asyncronous HTTP connection
- (void)requestUpdate
{
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://haobtc.com/exchange/api/v1/ticker"]];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://buysell.haobtc.com/broker/get_ticker"]];

// Set the request's user agent
[request addValue:@"btcbar/2.0 (HaobtcCNYFetcher)" forHTTPHeaderField:@"User-Agent"];
Expand Down Expand Up @@ -85,10 +85,10 @@ - (void)connectionDidFinishLoading:(NSURLConnection *)connection
// Results parsed successfully from JSON
if (results)
{
NSDictionary *ticker = [results objectForKey:@"ticker"];
NSDictionary *ticker = [results objectForKey:@"result"];

NSString *sell_price = [ticker objectForKey:@"sell"];
NSString *buy_price = [ticker objectForKey:@"buy"];
NSString *sell_price = [ticker objectForKey:@"bid"];
NSString *buy_price = [ticker objectForKey:@"ask"];
if (sell_price && buy_price) {
// NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
// NSString *resultsStatus = [numberFormatter stringFromNumber:sell_price];
Expand Down
8 changes: 1 addition & 7 deletions btcbar/Fetchers/OKCoinFutureUSDFetcher.m
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,7 @@ - (void)connectionDidFinishLoading:(NSURLConnection *)connection
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
[numberFormatter setNumberStyle:NSNumberFormatterDecimalStyle];
NSString *resultsStatus = [numberFormatter stringFromNumber:ticker];
resultsStatus = [NSString stringWithFormat:@"%@", resultsStatus];

NSNumberFormatter *currencyStyle = [[NSNumberFormatter alloc] init];
currencyStyle.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"];
currencyStyle.numberStyle = NSNumberFormatterCurrencyStyle;
resultsStatus = [currencyStyle stringFromNumber:[NSDecimalNumber decimalNumberWithString:resultsStatus]];
self.ticker = resultsStatus;
resultsStatus = [NSString stringWithFormat:@"$%@", resultsStatus];

self.ticker = resultsStatus;
}
Expand Down
4 changes: 2 additions & 2 deletions btcbar/btcbar-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.9.0</string>
<string>3.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>10</string>
<string>11</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.finance</string>
<key>LSMinimumSystemVersion</key>
Expand Down

0 comments on commit 584938e

Please sign in to comment.