Permalink
Browse files

Merge pull request #1 from killnine/master

Added Coinbase to list of exchanges.
  • Loading branch information...
bardic committed Jan 10, 2014
2 parents 6f354a2 + 317a2cd commit 8789de6bd0db33fb6622f4a25438b74d6b9317ec
View
@@ -25,4 +25,4 @@ SPEC CHECKSUMS:
AFNetworking: e499052cbf3d743e9bb727bb37adb9dc2547ba15
TouchJSON: 9e53f4df141b7f972766292b00b46bccf29f179a
COCOAPODS: 0.28.0
COCOAPODS: 0.29.0
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -32,6 +32,7 @@
AE106BA9318FCA4E3471D26B /* OBCryptsyService.m in Sources */ = {isa = PBXBuildFile; fileRef = AE106E37C3EEE48AE6278B2D /* OBCryptsyService.m */; };
AE106FB7FA6479BAB7255315 /* TODO in Resources */ = {isa = PBXBuildFile; fileRef = AE106333568E894F83A5CA25 /* TODO */; };
DAD919EE43A14E6C811DA9F7 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3C3A896A80D9444A93DC85A1 /* libPods.a */; };
FC02F7E31878BD850078C5C2 /* OBCoinbaseService.m in Sources */ = {isa = PBXBuildFile; fileRef = FC02F7E21878BD850078C5C2 /* OBCoinbaseService.m */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -91,6 +92,8 @@
AE106BBC169336A8B7050890 /* OBBitFinexService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OBBitFinexService.h; sourceTree = "<group>"; };
AE106D7D21BACCA0514323CB /* OBCryptsyService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OBCryptsyService.h; sourceTree = "<group>"; };
AE106E37C3EEE48AE6278B2D /* OBCryptsyService.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OBCryptsyService.m; sourceTree = "<group>"; };
FC02F7E11878BD850078C5C2 /* OBCoinbaseService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OBCoinbaseService.h; sourceTree = "<group>"; };
FC02F7E21878BD850078C5C2 /* OBCoinbaseService.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OBCoinbaseService.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -118,6 +121,8 @@
52CBCA93185BC1110030BB41 /* service */ = {
isa = PBXGroup;
children = (
FC02F7E11878BD850078C5C2 /* OBCoinbaseService.h */,
FC02F7E21878BD850078C5C2 /* OBCoinbaseService.m */,
52CBCA94185BC1110030BB41 /* OBAPIService.h */,
52CBCA95185BC1110030BB41 /* OBAPIService.m */,
AE106618C15A857A5A4CCABF /* OBBTCEService.m */,
@@ -400,6 +405,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
FC02F7E31878BD850078C5C2 /* OBCoinbaseService.m in Sources */,
55708A0A1853901100EF3B00 /* main.m in Sources */,
55708A111853901100EF3B00 /* OBAppDelegate.m in Sources */,
52CBCA9E185BC1110030BB41 /* OBCoinVO.m in Sources */,
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="4514" systemVersion="13A603" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="4514" systemVersion="13B3116" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment defaultVersion="1080" identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="4514"/>
@@ -11,6 +11,7 @@
<outlet property="bitfinex_ltc" destination="M2N-kp-rlz" id="ZFh-Hc-F4H"/>
<outlet property="btce_btc" destination="dgR-bq-GAd" id="h1I-bu-GYU"/>
<outlet property="btce_ltc" destination="88T-w0-Rh2" id="V2D-fb-3eQ"/>
<outlet property="coinbase_btc" destination="aut-23-4FJ" id="2ug-DN-DDL"/>
<outlet property="cryptsy_ltc" destination="iYx-gE-yFf" id="WVM-Wm-rfE"/>
<outlet property="cryptsy_qrk" destination="dJy-8f-7Ge" id="QRb-mn-u0N"/>
<outlet property="mtgox_btc" destination="n3k-Bf-vLR" id="VXG-6h-BEW"/>
@@ -22,7 +23,7 @@
<window title="Exchange Preferences" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" hidesOnDeactivate="YES" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" animationBehavior="default" id="dmn-wD-Iev" customClass="NSPanel">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES" utility="YES"/>
<rect key="contentRect" x="139" y="81" width="549" height="378"/>
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="878"/>
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="900"/>
<view key="contentView" id="s61-R8-75K">
<rect key="frame" x="0.0" y="0.0" width="549" height="378"/>
<autoresizingMask key="autoresizingMask"/>
@@ -60,6 +61,14 @@
<font key="font" metaFont="system"/>
</buttonCell>
</button>
<button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="aut-23-4FJ">
<rect key="frame" x="18" y="92" width="47" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" title="BTC" bezelStyle="regularSquare" imagePosition="left" inset="2" id="Dqw-lc-utG">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
<button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="1dD-cQ-MJ7">
<rect key="frame" x="99" y="135" width="46" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
@@ -119,6 +128,15 @@
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Ztl-gX-nOp">
<rect key="frame" x="18" y="112" width="62" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Coinbase" id="lAB-SF-aip">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="48H-bc-Aly">
<rect key="frame" x="180" y="333" width="189" height="25"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
@@ -69,6 +69,7 @@ -(void)setup{
[prefs setBool:NO forKey:@"CRYPTSY_QRK"];
[prefs setBool:NO forKey:@"BITFINEX_BTC"];
[prefs setBool:NO forKey:@"BITFINEX_LTC"];
[prefs setBool:NO forKey:@"COINBASE_BTC"];
}else{
if([prefs boolForKey:@"BTCE_BTC"]){
[coinArray addObject:[[OBCoinVO alloc] initWithCoinName:BTC andExchange:BTCE andCoinValue:nil]];
@@ -102,6 +103,11 @@ -(void)setup{
if([prefs boolForKey:@"BITFINEX_LTC"]){
[coinArray addObject:[[OBCoinVO alloc] initWithCoinName:LTC andExchange:BITFINEX andCoinValue:nil]];
}
if([prefs boolForKey:@"COINBASE_BTC"]){
[coinArray addObject:[[OBCoinVO alloc]
initWithCoinName:BTC andExchange:COINBASE andCoinValue:nil]];
}
}
[OBModel sharedSingleton].coins = coinArray;
View
@@ -16,7 +16,8 @@ typedef enum{
BTCE,
MTGOX,
CRYPTSY,
BITFINEX
BITFINEX,
COINBASE
}Exchanges;
@interface OBDefines : NSObject
@@ -21,6 +21,8 @@
IBOutlet NSButton *bitfinex_btc;
IBOutlet NSButton *bitfinex_ltc;
IBOutlet NSButton *coinbase_btc;
NSMutableArray *buttonArray;
}
@@ -34,6 +34,7 @@ -(void)awakeFromNib {
[buttonArray addObject:cryptsy_qrk];
[buttonArray addObject:bitfinex_btc];
[buttonArray addObject:bitfinex_ltc];
[buttonArray addObject:coinbase_btc];
[self setCheckBoxes];
}
@@ -48,6 +49,7 @@ - (void)setCheckBoxes {
cryptsy_qrk.state = [prefs boolForKey:@"CRYPTSY_QRK"];
bitfinex_btc.state = [prefs boolForKey:@"BITFINEX_BTC"];
bitfinex_ltc.state = [prefs boolForKey:@"BITFINEX_LTC"];
coinbase_btc.state = [prefs boolForKey:@"COINBASE_BTC"];
}
- (void)windowDidLoad
@@ -66,6 +68,7 @@ - (IBAction)onReset:(id)sender {
cryptsy_qrk.state = 0;
bitfinex_btc.state = 0;
bitfinex_ltc.state = 0;
coinbase_btc.state = 0;
[self onSave:nil];
}
@@ -100,6 +103,7 @@ -(IBAction)onSave:(id)sender{
[prefs setBool:[self intToBool:cryptsy_qrk.state] forKey:@"CRYPTSY_QRK"];
[prefs setBool:[self intToBool:bitfinex_btc.state] forKey:@"BITFINEX_BTC"];
[prefs setBool:[self intToBool:bitfinex_ltc.state] forKey:@"BITFINEX_LTC"];
[prefs setBool:[self intToBool:coinbase_btc.state] forKey:@"COINBASE_BTC"];
[self.delegate preferencesSaved];
}else{
@@ -9,6 +9,7 @@
#import "OBMtGoxService.h"
#import "OBCryptsyService.h"
#import "OBBitFinexService.h"
#import "OBCoinbaseService.h"
#import "OBCoinVO.h"
@implementation OBAPIService {
@@ -34,6 +35,10 @@ -(void)getPriceForCoin:(OBCoinVO *)coin {
NSLog(@"Ping Exchange: BITFINEX");
service = [[OBBitFinexService alloc] init];
break;
case COINBASE:
NSLog(@"Ping Exchange: COINBASE");
service = [[OBCoinbaseService alloc] init];
break;
default:
NSLog(@"Opps");
break;
@@ -0,0 +1,11 @@
//
// Created by Derek Heiser on 1/4/2014.
// Copyright (c) 2013 Thomas Gillis and Derek Heiser. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "OBXExchangeServiceProtocol.h"
@interface OBCoinbaseService: NSObject<OBXExchangeServiceProtocol>
@end
@@ -0,0 +1,44 @@
//
// Created by Derek Heiser on 1/4/2014.
// Copyright (c) 2013 Thomas Gillis and Derek Heiser. All rights reserved.
//
#import <AFNetworking/AFHTTPRequestOperation.h>
#import <AFNetworking/AFHTTPRequestOperationManager.h>
#import "OBCoinbaseService.h"
#import "OBDefines.h"
#import "OBCoinVO.h"
@implementation OBCoinbaseService {
NSMutableDictionary *endPointDict;
}
- (id)init {
self = [super init];
if (self) {
endPointDict = [NSMutableDictionary new];
[endPointDict setObject:@"https://coinbase.com/api/v1/prices/buy" forKey:BTC];
}
return self;
}
-(void)getPriceForCoin:(OBCoinVO *)coin{
//TODO: Stuff into model
[self requestCoinForIndex:coin];
}
-(void)requestCoinForIndex:(OBCoinVO *)coin{
//TODO Change all this to use AFNetworking
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
[manager GET:[endPointDict objectForKey:coin.coinName] parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
id subTotal = [responseObject objectForKey:@"subtotal"];
id amount = [subTotal objectForKey:@"amount"];
coin.coinValue = amount;
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"Error: %@", error);
}];
}
@end
View
@@ -76,7 +76,10 @@ - (NSMutableAttributedString *)toString {
exchange = @"CRYPTSY";
break;
case 3:
exchange = @"BITFINEX";
exchange = @"BITFINEX";
break;
case 4:
exchange = @"COINBASE";
break;
}

0 comments on commit 8789de6

Please sign in to comment.