Giter Site home page Giter Site logo

gdaxswift's Introduction

About me

๐Ÿ‘‹ Hi, I'm a tech enthusiast mainly building solutions with Next.js / .NET and hosting on Vercel / Azure.

gdaxswift's People

Contributors

anthonypuppo avatar apuppo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gdaxswift's Issues

All variables in GDAXHistoricRate return filled with the Epoch

So, when I execute this code:

   let now = NSDate()
    let yesterday = NSDate(timeIntervalSinceNow: -1*24*60*60)

    gdaxClient.public.getProductHistoricRates(productID: "ETH-USD", start: yesterday as Date, end: now as Date, granularity: 200, completionHandler: {(history, response, error) in
        
        print(history)
        
    })

I get this in the console:

Optional([GDAXSwift.GDAXHistoricRate(time: 1503083200, low: 1503083200.0, high: 1503083200.0, open: 1503083200.0, close: 1503083200.0, volume: 1503083200.0), GDAXSwift.GDAXHistoricRate(time: 1503083000, low: 1503083000.0, high: 1503083000.0, open: 1503083000.0, close: 1503083000.0, volume: 1503083000.0), GDAXSwift.GDAXHistoricRate(time: 1503082800, low: 1503082800.0, high: 1503082800.0, open: 1503082800.0, close: 1503082800.0, volume: 1503082800.0), GDAXSwift.GDAXHistoricRate(time: 1503082600, low: 1503082600.0, high: 1503082600.0, open: 1503082600.0, close: 1503082600.0, volume: 1503082600.0), GDAXSwift.GDAXHistoricRate(time: 1503082400, low: 1503082400.0, high: 1503082400.0, open: 1503082400.0, close: 1503082400.0, volume: 1503082400.0), GDAXSwift.GDAXHistoricRate(time: 1503082200, low: 1503082200.0, high: 1503082200.0, open: 1503082200.0, close: 1503082200.0, volume: 1503082200.0), GDAXSwift.GDAXHistoricRate(time: 1503082000, low: 1503082000.0, high: 1503082000.0, open: 1503082000.0, close: 1503082000.0, volume: 1503082000.0), GDAXSwift.GDAXHistoricRate(time: 1503081800, low: 1503081800.0, high: 1503081800.0, open: 1503081800.0, close: 1503081800.0, volume: 1503081800.0),

etc...etc...etc

Also receive the same result with the other HistoricRate function...

the issue is in GDAXPublicClient.swift:
When parsing the returned data only rates[0] is accessed, solved the issue by modifying code to this:

			var rates = [GDAXHistoricRate]()
			
			for rate in json {
				guard rate.count == 6 else {
					completionHandler(nil, nil, GDAXError.responseParsingFailure("One or more rates did not have an array length of 6"))
					
					return
				}
				
				guard let time = rate[0] as? Int else {
					completionHandler(nil, nil, GDAXError.responseParsingFailure("time"))
					
					return
				}
				
				guard let low = rate[1] as? Double else {
					completionHandler(nil, nil, GDAXError.responseParsingFailure("low"))
					
					return
				}
				
				guard let high = rate[2] as? Double else {
					completionHandler(nil, nil, GDAXError.responseParsingFailure("high"))
					
					return
				}
				
				guard let open = rate[3] as? Double else {
					completionHandler(nil, nil, GDAXError.responseParsingFailure("open"))
					
					return
				}
				
				guard let close = rate[4] as? Double else {
					completionHandler(nil, nil, GDAXError.responseParsingFailure("close"))
					
					return
				}
				
				guard let volume = rate[5] as? Double else {
					completionHandler(nil, nil, GDAXError.responseParsingFailure("volume"))
					
					return
				}

Market orders can not be placed

If I place a market order, I am providing either price or funds, but not both.

The API call succeeds, but the GDAXOrder parsing code returns responseParsingFailure("price").

This is a sample sandbox response, if I specify size (0.03) and funds 'nil':

["fill_fees": 0.0000000000000000, "settled": 0, "size": 0.03000000, "type": market, "stp": dc, "product_id": BTC-EUR, "status": pending, "id": a83f8e07-0904-425c-89b7-1192740d66be, "side": buy, "created_at": 2017-12-09T22:54:05.530799Z, "funds": 99750.6234413900000000, "post_only": 0, "executed_value": 0.0000000000000000, "filled_size": 0.00000000]

No failable initialisers for private client

Would there be a way to instantiate a private client and get a callback of whether the initialisation succeeded? a.k.a. the provided credentials were valid or not?

Thnx!

getAccountHistory() responseParsingFailure "id" error after successful getAccounts() call

Hello,

I'm creating my client by using GDAXClient(apiKey:secret64:passphrase:isSandbox). I then make a call to the method getAccounts(), which is successful. Consequently I am calling the getAccountHistory() call with as argument the GDAXAccount.id fetched from the previous call. This however results in an empty response and an error that reads:

(lldb) po error
โ–ฟ Optional
โ–ฟ some : GDAXError
- responseParsingFailure : "id"

Please help!

And awesome work on this library! ๐Ÿ‘Œ

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.