Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not reading KEY AND SECRET #7

Open
JoseAntonioCaraballo opened this issue Jan 29, 2018 · 3 comments
Open

Not reading KEY AND SECRET #7

JoseAntonioCaraballo opened this issue Jan 29, 2018 · 3 comments
Assignees

Comments

@JoseAntonioCaraballo
Copy link

I have been trying to fix this for the last couple of days can you please help. So I'm trying to compile this program to see if it works. I added the key.txt file in the same folder as the source and then i added " - --

  • apikey: "Key"
  • secret: "secret"
    (With the actual keys in there) But i keep getting this error i

Exception in thread "main" java.lang.NullPointerException
at com.example.bigboy.bittrexProfit.EncryptionUtility.calculateHash(EncryptionUtility.java:27)
at com.example.bigboy.bittrexProfit.Bittrex.getResponseBody(Bittrex.java:345)
at com.example.bigboy.bittrexProfit.Bittrex.getJson(Bittrex.java:263)
at com.example.bigboy.bittrexProfit.Bittrex.getMarketSummary(Bittrex.java:87)
at com.example.bigboy.bittrexProfit.MainActivity.main(MainActivity.java:17)

Can someone please help me

@platelminto
Copy link
Owner

Could you post what code you're trying to run? It doesn't seem to be an issue the API keys text file. Are you running the setAuthKeysFromTextFile() method? For a keys.txt file in the source folder (and in the same package), run setAuthKeysFromTextFile("keys.txt") on the wrapper.

@platelminto platelminto self-assigned this Jan 29, 2018
@JoseAntonioCaraballo
Copy link
Author

JoseAntonioCaraballo commented Jan 29, 2018

Im running the same example you gave us in the front
MainActivity.java--------
public class MainActivity {

public static void main(String...args) { Bittrex wrapper = new Bittrex(); wrapper.setAuthKeysFromTextFile("keys.txt"); String rawResponse = wrapper.getMarketSummary("BTC-LTC"); List<HashMap<String, String>> responseMapList = Bittrex.getMapsFromResponse(rawResponse);
(Only part of it)

Bittrex.java------
public void setAuthKeysFromTextFile(String textFile) try (Scanner scan = new Scanner(getClass().getResourceAsStream(textFile))) { String apikeyLine = scan.nextLine(), secretLine = scan.nextLine(); apikey = apikeyLine.substring(apikeyLine.indexOf("\"") + 1, apikeyLine.lastIndexOf("\"") ); secret = secretLine.substring(secretLine.indexOf("\"") + 1, secretLine.lastIndexOf("\"") ); } catch (NullPointerException | IndexOutOfBoundsException e) { System.err.println("Text file not found or corrupted - please attach key.txt & secret in the format provided."); } } (Only part of it)

keys.txt------------
`

  • apikey: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  • secret: "xxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    `

@JoseAntonioCaraballo
Copy link
Author

JoseAntonioCaraballo commented Jan 30, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants