# JSON, API ... Anfänger braucht eure Hilfe



## Conax (1. Nov 2017)

So damit meine Gedankengänge nachvollziehbar sind habe ich das ganze mal in drei Schritte untergliedert.

1. die Idee:
Da ich letztes Jahr ein paar JavaFX Projekte hatte wollte ich jetzt darauf aufbauen und ein Programm schreiben welches zu den virtuellen Währungen (wie Bitcoin, Ethereum, ....) auf den Handelsplattformen die wichtigsten Daten (nierdrigstes Angebot - bester Kaufpreis, Difficulty, ....) zieht diese zwischenspeichert (z.B. in einer ArrayList) und grafisch in einer Tabelle ausgibt.

2. der bisherige Ansatz:
Ich bin erst davon ausgegangen das ich hier recht einfach mit der Klasse URL (java.net.URL) arbeiten kann und beim Aufruf eines speziellen Links einfach die Informationen bekomme die ich benötige. Der untere Beispielcode gibt mir z.B. das Datum und Uhrzeit auf der Konsole zurück.


```
public void getValue() {
        try
        {

            URL url4 = new URL("https", "api.kraken.com", 443, "/0/public/Time");
            System.out.println("URL4: " + url4.toString() + "\n");       

            try (BufferedReader in = new BufferedReader(new InputStreamReader(url4.openStream())))
            {
                String inputLine;

               
               
                while ((inputLine = in.readLine()) != null)
                {
                    System.out.println(inputLine);
                }
            }

            catch (IOException ioe)
            {
                ioe.printStackTrace(System.err);
            }

        }

        catch (MalformedURLException mue)
        {
            mue.printStackTrace(System.err);
        }
    }
```

Ein Blick auf die Handelsplattform kraken zeigt mir aber dass das ganze wohl etwas komplexer ist als gedacht https://www.kraken.com/help/api

3. Wie kann ich das ganze trotzdem in Java realisieren?
Mir fehlt hier das nötige Wissen wie ich das ganze trotzdem realisieren kann. Welche Klassen benötige ich? Gibt es irgendwo ein Beispieltutorial das man nutzen könnte(Ich kann mir kaum vorstellen das ich der erste bin)? 

Bei JavaFX Problemen bin ich im Netz schnell auf Lösungen gestoßen (oracle docu, java api, stackoverflow, .....) aber aktuell mit dieser JSON API Geschichte steh ich aktuell voll auf dem Schlauch was vielleicht auch daran liegen könnte das ich bisher null Erfahrung habe was Websprachen angeht - leider.


----------



## Dompteur (2. Nov 2017)

Google wirft bei der Suche nach "Kraken Java API" bei mir folgendes Projekt aus : https://github.com/nyg/kraken-api-java
Da hast du eine Library, die dir das Protokoll (API-Key, Signierung,..) abnimmt. Ein kleines Beispielprogramm ist da ebenfalls dabei.

Ich habe mir das nicht weiter angesehen. Aber ich glaube, dass du als Ergebnis einen String im JSON Format zurückbekommst.
Also brauchst du einen JSON Parser. Google : "java json parser".


----------



## Janrupf (11. Nov 2017)

Ich weiß nicht ob es immer noch wichtig ist, aber ein super Json parser ist Gson. Damit lassen sie Json strings direkt in Java Objekte umwandeln. Oder man arbeitet halt mit JsonObjects, da kann man ebenfalls Gson oder org.json (Wie genau die Library heißt weiß ich nicht) nehmen. Aber meine Favorit wird Gson wegen des oben gennanten features mit dem einfachen (de)serialisieren bleiben.


----------



## Conax (26. Jan 2018)

So das hat jetzt etwas gedauert aber hier mal ein kurzes Update ;-)

Erstmal ein fettes Danke an @Dompteur und @Janrupf

Ich habe jetzt einige Handelsplätze mal in mein Programm eingepflegt. Auch das kraken programm auf github das natürlich weit mehr als nur Angebotsabfragen bietet habe ich mit eingebaut. Also die Doku auf den Handelsplätzen bzgl. ihrer API lässt teilweise ja mal echt zu wünschen übrig vom Support ganz zu schweigen (warte jetzt seit über 2 Monaten auf nen bitcoin.de API key) - naja das sind eben diese Fintech Startups.  Im Prinzip bekomme ich von den Handelsplätzen schon mal den entsprechenden JSON String zurück (zumindest von 6 Stück bisher). Das ganze sieht bisher so aus:


```
/***** File content AnyCoinDirect Bitcoin *****/n
{"Nonce":0,"Data":[{"Id":-1,"Name":"No payment method","CoinAmount":1,"FiatAmount":8988.38},{"Id":3,"Name":"Bancontact / Mistercash","CoinAmount":1,"FiatAmount":9094.30},{"Id":5,"Name":"Giropay","CoinAmount":1,"FiatAmount":9164.91},{"Id":1,"Name":"iDEAL","CoinAmount":1,"FiatAmount":8988.68},{"Id":7,"Name":"Mybank","CoinAmount":1,"FiatAmount":9142.77},{"Id":4,"Name":"SEPA","CoinAmount":1,"FiatAmount":9032.94},{"Id":2,"Name":"Sofort","CoinAmount":1,"FiatAmount":9341.24},{"Id":10,"Name":"TrustPay","CoinAmount":1,"FiatAmount":9163.93}],"Errors":[],"HasErrors":false}
/***** File content Bittrex Bitcoin *****/n
{"success":true,"message":"","result":[{"Quantity":0.06505437,"Rate":10874.21000000},{"Quantity":0.02000000,"Rate":10876.99999999},{"Quantity":0.72726216,"Rate":10879.99999999},{"Quantity":0.47787587,"Rate":10882.91383021},{"Quantity":0.03733672,"Rate":10896.69999999},{"Quantity":1.64300000,"Rate":10898.99999999},{"Quantity":0.10460031,"Rate":10899.00000000},{"Quantity":0.46403763,"Rate":10900.00000000},{"Quantity":1.67293990,"Rate":10901.00000000},{"Quantity":0.00058763,"Rate":10916.46500542},{"Quantity":0.00407430,"Rate":10920.58047397},{"Quantity":0.00660000,"Rate":10921.86245684},{"Quantity":0.00340000,"Rate":10925.00000000},{"Quantity":0.00350000,"Rate":10939.14999072},{"Quantity":1.38000000,"Rate":10939.30000000},{"Quantity":0.00049695,"Rate":10940.32000000},{"Quantity":0.00022595,"Rate":10973.01006832},{"Quantity":0.00025516,"Rate":10973.60473117},{"Quantity":0.02287506,"Rate":10974.09999998},{"Quantity":0.00025108,"Rate":10974.40146174},{"Quantity":0.00096750,"Rate":10979.46000000},{"Quantity":1.00000000,"Rate":10985.29272725},{"Quantity":0.27309240,"Rate":10985.29272726},{"Quantity":0.00033655,"Rate":10989.38698944},{"Quantity":0.00023385,"Rate":10994.54810000},{"Quantity":0.03196325,"Rate":10995.00000000},{"Quantity":0.65803205,"Rate":10998.00000000},{"Quantity":0.00064750,"Rate":10999.17500000},{"Quantity":0.00761083,"Rate":10999.51468167},{"Quantity":0.98852233,"Rate":11000.00000000},{"Quantity":0.00052180,"Rate":11002.83611429},{"Quantity":0.04269027,"Rate":11005.00759148},{"Quantity":1.18093493,"Rate":11009.00000000},{"Quantity":0.00660000,"Rate":11009.16488710},{"Quantity":0.02694458,"Rate":11020.00000000},{"Quantity":0.00145112,"Rate":11026.00000000},{"Quantity":2.13520000,"Rate":11026.15600000},{"Quantity":0.00148066,"Rate":11026.53100000},{"Quantity":0.00027489,"Rate":11026.60104993},{"Quantity":0.00028250,"Rate":11027.62478943},{"Quantity":0.00145085,"Rate":11028.00000000},{"Quantity":0.00148038,"Rate":11028.57100000},{"Quantity":0.00145059,"Rate":11030.00000000},{"Quantity":0.00148011,"Rate":11030.61200000},{"Quantity":0.00145033,"Rate":11032.00000000},{"Quantity":0.00800000,"Rate":11040.65928694},{"Quantity":0.00147874,"Rate":11040.81600000},{"Quantity":0.08747307,"Rate":11048.00000001},{"Quantity":0.00027780,"Rate":11049.68003901},{"Quantity":0.10020597,"Rate":11050.10908455},{"Quantity":0.45154033,"Rate":11052.00000000},{"Quantity":0.00147683,"Rate":11055.10200000},{"Quantity":0.16995617,"Rate":11058.79500000},{"Quantity":0.00332525,"Rate":11059.90000000},{"Quantity":0.12817288,"Rate":11060.00000002},{"Quantity":0.10200200,"Rate":11061.57782001},{"Quantity":0.02932213,"Rate":11063.85685130},{"Quantity":0.00054789,"Rate":11065.35222858},{"Quantity":0.00677235,"Rate":11073.01200000},{"Quantity":0.00147330,"Rate":11081.63300000},{"Quantity":0.10000000,"Rate":11085.00000000},{"Quantity":0.00242787,"Rate":11085.35600000},{"Quantity":0.00147248,"Rate":11087.75500000},{"Quantity":0.02096752,"Rate":11087.88447586},{"Quantity":0.00147221,"Rate":11089.79600000},{"Quantity":0.00147194,"Rate":11091.83700000},{"Quantity":0.30000000,"Rate":11093.00000000},{"Quantity":0.00356468,"Rate":11093.01915000},{"Quantity":0.00147167,"Rate":11093.87800000},{"Quantity":0.00147140,"Rate":11095.91800000},{"Quantity":0.01850754,"Rate":11097.00000000},{"Quantity":0.00147113,"Rate":11097.95900000},{"Quantity":0.00144170,"Rate":11098.00000000},{"Quantity":0.00160000,"Rate":11098.87904926},{"Quantity":0.00632351,"Rate":11099.99999926},{"Quantity":0.84731335,"Rate":11100.00000000},{"Quantity":0.00187211,"Rate":11100.23406000},{"Quantity":0.00144118,"Rate":11102.00000000},{"Quantity":0.00147059,"Rate":11102.04100000},{"Quantity":0.00100000,"Rate":11102.80000000},{"Quantity":0.00144092,"Rate":11104.00000000},{"Quantity":0.00147032,"Rate":11104.08200000},{"Quantity":0.00144066,"Rate":11106.00000000},{"Quantity":0.00147005,"Rate":11106.12200000},{"Quantity":0.00144040,"Rate":11108.00000000},{"Quantity":0.00146978,"Rate":11108.16300000},{"Quantity":0.00166669,"Rate":11108.82015204},{"Quantity":0.00144014,"Rate":11110.00000000},{"Quantity":0.00146951,"Rate":11110.20400000},{"Quantity":0.05000000,"Rate":11111.00000000},{"Quantity":4.17572339,"Rate":11111.09000000},{"Quantity":0.00477700,"Rate":11111.25286442},{"Quantity":0.00143988,"Rate":11112.00000000},{"Quantity":0.00146924,"Rate":11112.24500000},{"Quantity":0.01900000,"Rate":11112.39557000},{"Quantity":0.00143963,"Rate":11114.00000000},{"Quantity":0.00146897,"Rate":11114.28600000},{"Quantity":0.00143937,"Rate":11116.00000000},{"Quantity":0.00146870,"Rate":11116.32700000},{"Quantity":0.00143911,"Rate":11118.00000000},{"Quantity":0.00146843,"Rate":11118.36700000},{"Quantity":0.00143885,"Rate":11120.00000000},{"Quantity":0.00146816,"Rate":11120.40800000},{"Quantity":0.00143859,"Rate":11122.00000000},{"Quantity":0.00146789,"Rate":11122.44900000},{"Quantity":0.00143833,"Rate":11124.00000000},{"Quantity":0.00146762,"Rate":11124.49000000},{"Quantity":0.00143807,"Rate":11126.00000000},{"Quantity":0.00146735,"Rate":11126.53100000},{"Quantity":0.03831563,"Rate":11126.57511665},{"Quantity":0.00057528,"Rate":11127.86834286},{"Quantity":0.00143781,"Rate":11128.00000000},{"Quantity":0.00143756,"Rate":11130.00000000},{"Quantity":0.00143730,"Rate":11132.00000000},{"Quantity":0.00143704,"Rate":11134.00000000},{"Quantity":0.00340983,"Rate":11135.47703960},{"Quantity":0.00143678,"Rate":11136.00000000},{"Quantity":0.00143652,"Rate":11138.00000000},{"Quantity":0.49126503,"Rate":11140.00000000},{"Quantity":0.00143601,"Rate":11142.00000000},{"Quantity":0.01756609,"Rate":11143.08150000},{"Quantity":0.00944668,"Rate":11147.00000000},{"Quantity":0.00146440,"Rate":11148.98000000},{"Quantity":2.39474664,"Rate":11150.00000000},{"Quantity":0.20000000,"Rate":11156.22000000},{"Quantity":0.02117341,"Rate":11160.00000000},{"Quantity":0.04000000,"Rate":11168.80192850},{"Quantity":0.00908759,"Rate":11170.00000000},{"Quantity":0.26851596,"Rate":11172.52039312},{"Quantity":0.82904651,"Rate":11175.00000000},{"Quantity":0.00199300,"Rate":11177.13099999},{"Quantity":0.00143138,"Rate":11178.00000000},{"Quantity":0.00146039,"Rate":11179.59200000},{"Quantity":0.95516046,"Rate":11180.00000000},{"Quantity":0.00146012,"Rate":11181.63300000},{"Quantity":0.00145985,"Rate":11183.67300000},{"Quantity":0.00145959,"Rate":11185.71400000},{"Quantity":0.00143036,"Rate":11186.00000000},{"Quantity":0.00145932,"Rate":11187.75500000},{"Quantity":0.00143010,"Rate":11188.00000000},{"Quantity":0.00660000,"Rate":11188.32857494},{"Quantity":4.17572339,"Rate":11188.37200000},{"Quantity":0.03529850,"Rate":11189.00000000},{"Quantity":0.00294879,"Rate":11189.62797942},{"Quantity":0.00145906,"Rate":11189.79600000},{"Quantity":0.48818548,"Rate":11190.00000000},{"Quantity":0.00060405,"Rate":11190.38445715},{"Quantity":0.27203085,"Rate":11191.00000000},{"Quantity":0.00145879,"Rate":11191.83700000},{"Quantity":0.00142959,"Rate":11192.00000000},{"Quantity":0.00145852,"Rate":11193.87800000},{"Quantity":0.00142934,"Rate":11194.00000000},{"Quantity":2.09107387,"Rate":11195.00000000},{"Quantity":0.00145826,"Rate":11195.91800000},{"Quantity":0.00142908,"Rate":11196.00000000},{"Quantity":0.00145799,"Rate":11197.95900000},{"Quantity":0.00142883,"Rate":11198.00000000},{"Quantity":0.27755349,"Rate":11199.00000000},{"Quantity":3.00313291,"Rate":11200.00000000},{"Quantity":0.28363829,"Rate":11200.00000001},{"Quantity":0.00692874,"Rate":11200.44000000},{"Quantity":0.00531693,"Rate":11201.06999997},{"Quantity":0.00142832,"Rate":11202.00000000},{"Quantity":0.00145746,"Rate":11202.04100000},{"Quantity":0.00099447,"Rate":11203.05239998},{"Quantity":0.00142806,"Rate":11204.00000000},{"Quantity":0.00145719,"Rate":11204.08200000},{"Quantity":3.08803530,"Rate":11206.00000000},{"Quantity":0.00145693,"Rate":11206.12200000},{"Quantity":0.00142755,"Rate":11208.00000000},{"Quantity":0.00145666,"Rate":11208.16300000},{"Quantity":0.01811102,"Rate":11208.64500000},{"Quantity":0.00142730,"Rate":11210.00000000},{"Quantity":0.00145640,"Rate":11210.20400000},{"Quantity":0.00142704,"Rate":11212.00000000},{"Quantity":0.00145613,"Rate":11212.24500000},{"Quantity":0.00142679,"Rate":11214.00000000},{"Quantity":0.00145587,"Rate":11214.28600000},{"Quantity":0.02000000,"Rate":11215.00000000},{"Quantity":0.01810018,"Rate":11215.35597700},{"Quantity":0.00142653,"Rate":11216.00000000},{"Quantity":0.06072263,"Rate":11216.09150000},{"Quantity":0.00145560,"Rate":11216.32700000},{"Quantity":0.00142628,"Rate":11218.00000000},{"Quantity":0.00145534,"Rate":11218.36700000},{"Quantity":0.00211585,"Rate":11219.99999997},{"Quantity":0.12797246,"Rate":11220.00000000},{"Quantity":0.06749963,"Rate":11220.31254959},{"Quantity":0.00145507,"Rate":11220.40800000},{"Quantity":0.45753147,"Rate":11220.63926667},{"Quantity":0.00142577,"Rate":11222.00000000},{"Quantity":0.00145481,"Rate":11222.44900000},{"Quantity":0.00142552,"Rate":11224.00000000},{"Quantity":0.00145455,"Rate":11224.49000000},{"Quantity":0.00142526,"Rate":11226.00000000},{"Quantity":0.00145428,"Rate":11226.53100000},{"Quantity":0.00142501,"Rate":11228.00000000},{"Quantity":0.00145402,"Rate":11228.57100000},{"Quantity":0.09069457,"Rate":11230.00000000},{"Quantity":0.00145375,"Rate":11230.61200000},{"Quantity":0.00026979,"Rate":11231.14511984},{"Quantity":0.00142450,"Rate":11232.00000000},{"Quantity":0.00145349,"Rate":11232.65300000},{"Quantity":0.00793553,"Rate":11233.42378440},{"Quantity":0.00145322,"Rate":11234.69400000},{"Quantity":0.00142399,"Rate":11236.00000000},{"Quantity":0.00145296,"Rate":11236.73500000},{"Quantity":0.14337024,"Rate":11238.00000000},{"Quantity":0.00145270,"Rate":11238.77600000},{"Quantity":0.08357980,"Rate":11240.00000000},{"Quantity":0.00145243,"Rate":11240.81600000},{"Quantity":0.00142323,"Rate":11242.00000000},{"Quantity":0.00145217,"Rate":11242.85700000},{"Quantity":0.00142298,"Rate":11244.00000000},{"Quantity":0.00145191,"Rate":11244.89800000},{"Quantity":0.27162960,"Rate":11244.94759999},{"Quantity":0.00142273,"Rate":11246.00000000},{"Quantity":0.00439163,"Rate":11246.83181000},{"Quantity":0.00145164,"Rate":11246.93900000},{"Quantity":0.00142248,"Rate":11248.00000000},{"Quantity":0.00145138,"Rate":11248.98000000},{"Quantity":0.16750000,"Rate":11249.00000000},{"Quantity":1.00000000,"Rate":11249.99999999},{"Quantity":7.79559951,"Rate":11250.00000000},{"Quantity":0.38745350,"Rate":11250.58825000},{"Quantity":0.00145112,"Rate":11251.02000000},{"Quantity":0.00142197,"Rate":11252.00000000},{"Quantity":0.00063425,"Rate":11252.90057143},{"Quantity":0.00145085,"Rate":11253.06100000},{"Quantity":0.00142172,"Rate":11254.00000000},{"Quantity":0.00145059,"Rate":11255.10200000},{"Quantity":0.00142146,"Rate":11256.00000000},{"Quantity":0.00145033,"Rate":11257.14300000},{"Quantity":0.00142121,"Rate":11258.00000000},{"Quantity":0.00145006,"Rate":11259.18400000},{"Quantity":0.09567983,"Rate":11260.00000000},{"Quantity":0.00144980,"Rate":11261.22400000},{"Quantity":0.00592964,"Rate":11262.00000000},{"Quantity":0.00144954,"Rate":11263.26500000},{"Quantity":0.00142045,"Rate":11264.00000000},{"Quantity":0.12460000,"Rate":11264.95519820},{"Quantity":0.00144928,"Rate":11265.30600000},{"Quantity":0.00142020,"Rate":11266.00000000},{"Quantity":0.02162051,"Rate":11266.31081712},{"Quantity":0.00144901,"Rate":11267.34700000},{"Quantity":0.00141995,"Rate":11268.00000000},{"Quantity":0.00144875,"Rate":11269.38800000},{"Quantity":0.00141970,"Rate":11270.00000000},{"Quantity":0.00144849,"Rate":11271.42900000},{"Quantity":0.00141945,"Rate":11272.00000000},{"Quantity":0.00144823,"Rate":11273.46900000},{"Quantity":0.00141919,"Rate":11274.00000000},{"Quantity":0.00144796,"Rate":11275.51000000},{"Quantity":0.00275489,"Rate":11276.00000000},{"Quantity":0.00660000,"Rate":11279.67665736},{"Quantity":0.44310041,"Rate":11284.12394166},{"Quantity":0.00270000,"Rate":11284.21704853},{"Quantity":0.03000000,"Rate":11286.66000000},{"Quantity":0.00500000,"Rate":11287.14147077},{"Quantity":0.01861067,"Rate":11290.00000000},{"Quantity":0.00026979,"Rate":11290.65700000},{"Quantity":0.17000000,"Rate":11291.10000000},{"Quantity":0.00021583,"Rate":11292.76997904},{"Quantity":0.04678949,"Rate":11295.00000000},{"Quantity":0.00251220,"Rate":11297.82165272},{"Quantity":3.06101314,"Rate":11298.00000000},{"Quantity":0.13497787,"Rate":11299.00000000},{"Quantity":8.80831121,"Rate":11300.00000000},{"Quantity":0.00281714,"Rate":11300.25000000},{"Quantity":0.01000000,"Rate":11300.35999998},{"Quantity":0.00310027,"Rate":11302.53717753},{"Quantity":0.00200000,"Rate":11303.33902379},{"Quantity":0.30000000,"Rate":11305.00000000},{"Quantity":0.02660138,"Rate":11305.80444066},{"Quantity":0.00500000,"Rate":11310.00000000},{"Quantity":0.76571467,"Rate":11314.00000000},{"Quantity":0.38583630,"Rate":11315.00000000},{"Quantity":0.00066596,"Rate":11315.41668572},{"Quantity":0.00564410,"Rate":11316.16070050},{"Quantity":3.25186462,"Rate":11319.00000000},{"Quantity":0.04468207,"Rate":11319.29030625},{"Quantity":0.10000000,"Rate":11320.00000000},{"Quantity":0.00123239,"Rate":11320.75484582},{"Quantity":0.01106332,"Rate":11320.96384000},{"Quantity":0.01497221,"Rate":11323.67148900},{"Quantity":0.01000000,"Rate":11325.00000000},{"Quantity":2.54840000,"Rate":11330.00000000},{"Quantity":0.00087448,"Rate":11330.84054535},{"Quantity":0.00281817,"Rate":11330.90284648},{"Quantity":0.08845848,"Rate":11333.00000000},{"Quantity":0.00026979,"Rate":11334.07600000},{"Quantity":0.00100000,"Rate":11334.83798799},{"Quantity":0.35289312,"Rate":11334.87665848},{"Quantity":0.00101781,"Rate":11337.00000000},{"Quantity":3.00000000,"Rate":11339.00000000},{"Quantity":0.04868375,"Rate":11345.00000000},{"Quantity":4.66192842,"Rate":11347.00000000},{"Quantity":3.13914916,"Rate":11349.00000000},{"Quantity":0.01257914,"Rate":11349.49617805},{"Quantity":3.45464880,"Rate":11350.00000000},{"Quantity":0.01000012,"Rate":11350.95519818},{"Quantity":0.00877827,"Rate":11352.11100000},{"Quantity":0.00593468,"Rate":11352.20302071},{"Quantity":0.20000000,"Rate":11354.00000000},{"Quantity":0.50000000,"Rate":11355.00000000},{"Quantity":0.73253242,"Rate":11357.00000000},{"Quantity":0.99937402,"Rate":11359.00000000},{"Quantity":0.00293863,"Rate":11359.30012810},{"Quantity":0.06980943,"Rate":11360.00000000},{"Quantity":0.00100000,"Rate":11361.62100000},{"Quantity":0.36231802,"Rate":11362.00000000},{"Quantity":0.00124472,"Rate":11366.03786520},{"Quantity":3.00000000,"Rate":11369.00000000},{"Quantity":0.00660000,"Rate":11369.33078850},{"Quantity":0.10000000,"Rate":11374.00000000},{"Quantity":0.01682580,"Rate":11375.00000000},{"Quantity":0.71147011,"Rate":11375.37200000},{"Quantity":0.00069926,"Rate":11377.93280000},{"Quantity":0.00833583,"Rate":11379.20556000},{"Quantity":0.49147792,"Rate":11380.00000000},{"Quantity":3.78191890,"Rate":11380.99999998},{"Quantity":0.01221146,"Rate":11382.58349496},{"Quantity":0.01078000,"Rate":11383.44000000},{"Quantity":0.01633989,"Rate":11383.75500000},{"Quantity":0.00880561,"Rate":11384.79000000},{"Quantity":0.00140839,"Rate":11387.34500002},{"Quantity":0.00880313,"Rate":11388.00000000},{"Quantity":0.10237597,"Rate":11389.99999999},{"Quantity":0.05320831,"Rate":11390.00000000},{"Quantity":4.76885850,"Rate":11392.00000000},{"Quantity":0.13285831,"Rate":11393.85678750},{"Quantity":0.00873258,"Rate":11394.90915725},{"Quantity":0.64972779,"Rate":11395.00000000},{"Quantity":0.23008260,"Rate":11399.00000000},{"Quantity":5.34721524,"Rate":11400.00000000},{"Quantity":0.02000000,"Rate":11400.00000001},{"Quantity":0.01220314,"Rate":11400.48473610},{"Quantity":0.10000000,"Rate":11400.62169496},{"Quantity":0.03580280,"Rate":11402.00000000},{"Quantity":0.08400000,"Rate":11403.00000000},{"Quantity":0.00045067,"Rate":11408.61037198},{"Quantity":0.02366379,"Rate":11409.52000000},{"Quantity":0.01128000,"Rate":11410.00000000},{"Quantity":0.00451326,"Rate":11413.38485284},{"Quantity":0.10000000,"Rate":11416.00000000},{"Quantity":0.00965982,"Rate":11419.09440004},{"Quantity":0.04439600,"Rate":11419.61952062},{"Quantity":0.01358482,"Rate":11421.97588125},{"Quantity":0.19630906,"Rate":11422.04437464},{"Quantity":0.02000000,"Rate":11423.00000000},{"Quantity":0.17507134,"Rate":11423.91442150},{"Quantity":0.00623141,"Rate":11424.05240691},{"Quantity":0.00547201,"Rate":11424.97028602},{"Quantity":0.01000000,"Rate":11425.00000000},{"Quantity":0.00995769,"Rate":11425.62700000},{"Quantity":0.04691617,"Rate":11429.18632864},{"Quantity":0.02712107,"Rate":11430.00000000},{"Quantity":0.50283652,"Rate":11432.00000000},{"Quantity":0.08863913,"Rate":11432.35999999},{"Quantity":0.43729329,"Rate":11433.97364365},{"Quantity":0.02384825,"Rate":11434.00000000},{"Quantity":0.08766177,"Rate":11436.00000000},{"Quantity":0.00073423,"Rate":11440.44891429},{"Quantity":0.05375653,"Rate":11442.00000000},{"Quantity":0.26212084,"Rate":11443.11229102},{"Quantity":0.10000000,"Rate":11444.44444444},{"Quantity":0.02000000,"Rate":11445.00000000},{"Quantity":0.00021583,"Rate":11447.83500001},{"Quantity":0.10000000,"Rate":11448.00000000},{"Quantity":0.67289516,"Rate":11449.34621587},{"Quantity":0.00100000,"Rate":11449.43964149},{"Quantity":4.15107754,"Rate":11450.00000000},{"Quantity":0.00751592,"Rate":11450.99999999},{"Quantity":0.02994786,"Rate":11453.82450000},{"Quantity":0.12200000,"Rate":11456.00000000},{"Quantity":0.10812212,"Rate":11456.63417073},{"Quantity":0.95173426,"Rate":11458.00000000},{"Quantity":0.00254202,"Rate":11460.00000000},{"Quantity":0.20000000,"Rate":11461.00000000},{"Quantity":0.00660000,"Rate":11461.66459404},{"Quantity":0.00457226,"Rate":11462.57944554},{"Quantity":0.00091674,"Rate":11464.68441750},{"Quantity":1.53115863,"Rate":11465.00000000},{"Quantity":8.53207805,"Rate":11468.00000000},{"Quantity":0.11644458,"Rate":11470.00000000},{"Quantity":0.00800414,"Rate":11472.00000000},{"Quantity":0.00275248,"Rate":11472.89312940},{"Quantity":0.00112401,"Rate":11473.05183890},{"Quantity":0.03000000,"Rate":11474.00000000},{"Quantity":0.01000000,"Rate":11475.00000000},{"Quantity":0.00775594,"Rate":11476.90272860},{"Quantity":1.00200000,"Rate":11478.00000000},{"Quantity":0.00091581,"Rate":11478.14147244},{"Quantity":0.26396349,"Rate":11479.51000000},{"Quantity":0.56391967,"Rate":11480.00000000},{"Quantity":0.00389025,"Rate":11482.08507620},{"Quantity":0.00250000,"Rate":11482.76089497},{"Quantity":0.90494992,"Rate":11485.00000000},{"Quantity":0.03000000,"Rate":11486.66000000},{"Quantity":0.00457164,"Rate":11487.78294743},{"Quantity":0.36300000,"Rate":11488.00000000},{"Quantity":0.27317424,"Rate":11489.97000000},{"Quantity":0.00100000,"Rate":11489.99999999},{"Quantity":0.47168433,"Rate":11490.00000000},{"Quantity":9.51487690,"Rate":11490.00005000},{"Quantity":0.00877501,"Rate":11490.50000000},{"Quantity":0.03789028,"Rate":11491.00000000},{"Quantity":0.00295158,"Rate":11492.93475718},{"Quantity":0.01282204,"Rate":11493.09401433},{"Quantity":0.00615276,"Rate":11494.35000000},{"Quantity":0.06212517,"Rate":11495.01500002},{"Quantity":0.10000000,"Rate":11495.70000000},{"Quantity":0.00654299,"Rate":11495.90179312},{"Quantity":5.40152114,"Rate":11497.00000000},{"Quantity":0.01137055,"Rate":11497.97349999},{"Quantity":0.08114328,"Rate":11498.00000000},{"Quantity":0.05000000,"Rate":11498.82500002},{"Quantity":8.93609186,"Rate":11499.00000000},{"Quantity":0.00958933,"Rate":11499.00300000},{"Quantity":0.00400000,"Rate":11499.10000000},{"Quantity":0.20000000,"Rate":11499.21999988},{"Quantity":0.00278620,"Rate":11499.56533000},{"Quantity":0.00692028,"Rate":11499.90000000},{"Quantity":0.00494322,"Rate":11499.99900000},{"Quantity":0.00359308,"Rate":11499.99980000},{"Quantity":22.39248530,"Rate":11500.00000000},{"Quantity":0.00470098,"Rate":11500.26999992},{"Quantity":0.10000000,"Rate":11500.62169496},{"Quantity":0.05429028,"Rate":11500.91840000},{"Quantity":0.05229980,"Rate":11501.00000000},{"Quantity":0.07261015,"Rate":11502.00000000},{"Quantity":0.03100000,"Rate":11502.10000000},{"Quantity":0.00077094,"Rate":11502.96502858},{"Quantity":0.10000000,"Rate":11505.00000000},{"Quantity":0.41581167,"Rate":11505.53438959},{"Quantity":0.00871209,"Rate":11507.00000000},{"Quantity":0.01487113,"Rate":11508.00000000},{"Quantity":0.00805286,"Rate":11508.11238754},{"Quantity":0.01510295,"Rate":11508.13814201},{"Quantity":0.00775736,"Rate":11509.00000000},{"Quantity":0.09179760,"Rate":11510.00000000},{"Quantity":0.00682271,"Rate":11511.02832861},{"Quantity":0.00961612,"Rate":11512.22999999},{"Quantity":0.10000000,"Rate":11515.00000000},{"Quantity":0.12681550,"Rate":11517.95000000},{"Quantity":0.10000000,"Rate":11517.99999995},{"Quantity":0.30000000,"Rate":11518.82393114},{"Quantity":0.06852803,"Rate":11520.00000000},{"Quantity":0.20000000,"Rate":11520.00000001},{"Quantity":0.01987317,"Rate":11520.76100000},{"Quantity":0.02855263,"Rate":11523.45169873},{"Quantity":1.00000000,"Rate":11524.90000000},{"Quantity":0.21585378,"Rate":11525.00000000},{"Quantity":0.02200000,"Rate":11530.00000000},{"Quantity":0.00087075,"Rate":11533.00000000},{"Quantity":2.00000100,"Rate":11534.00000000},{"Quantity":0.06589322,"Rate":11535.00000000},{"Quantity":0.00103710,"Rate":11535.48473610},{"Quantity":0.00483172,"Rate":11538.11538000},{"Quantity":0.10610622,"Rate":11539.00000000},{"Quantity":0.04926198,"Rate":11539.08235103},{"Quantity":0.20000000,"Rate":11540.01499999},{"Quantity":0.03208600,"Rate":11542.00000000},{"Quantity":0.00378036,"Rate":11542.23110789},{"Quantity":0.17468005,"Rate":11543.11229101},{"Quantity":0.03774211,"Rate":11544.00000000},{"Quantity":0.00100000,"Rate":11546.30000000},{"Quantity":0.05710526,"Rate":11546.54478831},{"Quantity":0.00561535,"Rate":11547.59000000},{"Quantity":0.00216469,"Rate":11549.00000000},{"Quantity":2.38357880,"Rate":11550.00000000},{"Quantity":0.09000000,"Rate":11550.42000000},{"Quantity":0.05379187,"Rate":11554.00000000},{"Quantity":0.00660000,"Rate":11555.80735294},{"Quantity":0.10220980,"Rate":11557.90000000},{"Quantity":0.10131278,"Rate":11559.00000000},{"Quantity":0.05000000,"Rate":11560.00000000},{"Quantity":0.71352053,"Rate":11565.00000000},{"Quantity":0.00080948,"Rate":11565.48114286},{"Quantity":0.00946489,"Rate":11566.03725001},{"Quantity":0.15000000,"Rate":11566.74999998},{"Quantity":0.00687013,"Rate":11567.75117933},{"Quantity":0.05000000,"Rate":11567.76000000},{"Quantity":0.11721665,"Rate":11568.00000000},{"Quantity":0.10329671,"Rate":11568.06714091},{"Quantity":0.02008700,"Rate":11569.75463835},{"Quantity":0.10000000,"Rate":11574.00000000},{"Quantity":0.08647171,"Rate":11574.99000000},{"Quantity":0.05329688,"Rate":11575.00000000},{"Quantity":0.01808434,"Rate":11577.87000000},{"Quantity":0.11148816,"Rate":11580.00000000},{"Quantity":0.00416551,"Rate":11582.00000000},{"Quantity":1.00000000,"Rate":11584.90000000},{"Quantity":0.06256605,"Rate":11585.39751758},{"Quantity":0.54721003,"Rate":11586.10000000},{"Quantity":0.03000000,"Rate":11586.66000000},{"Quantity":0.00258166,"Rate":11587.62206070},{"Quantity":0.83275950,"Rate":11588.45257942},{"Quantity":0.03996886,"Rate":11589.00000000},{"Quantity":0.05821712,"Rate":11590.00000000}]}
/***** File content Poloniex Bitcoin *****/n
{"asks":[["10849.41635993",1],["10854.92503517",0.10378524],["10854.92503529",0.33808773],["10854.92503571",1.095],["10861.25885086",0.00869184],["10861.25885087",0.92179485],["10866.54012037",1.361],["10866.54012038",1.137],["10872.33103264",0.404],["10872.33103265",1.1]],"bids":[["10840.47779162",1.65],["10840.47779161",0.18691227],["10840.47779159",0.91027391],["10840.47779150",0.00010348],["10840.47779149",0.00036899],["10840.47779148",0.0001845],["10838.60000000",0.00280856],["10836.82004680",0.00033057],["10835.61996560",0.0001],["10835.55000001",0.00018458]],"isFrozen":"0","seq":192406445}
/***** File content hitbtc Bitcoin *****/n
{"ask":[{"price":"10825.42","size":"0.01"},{"price":"10825.43","size":"0.02"},{"price":"10825.44","size":"0.06"},{"price":"10827.29","size":"0.50"},{"price":"10827.30","size":"0.15"},{"price":"10828.39","size":"0.01"},{"price":"10828.45","size":"0.18"},{"price":"10832.31","size":"0.01"},{"price":"10832.32","size":"0.50"},{"price":"10832.33","size":"1.11"},{"price":"10832.40","size":"0.06"},{"price":"10837.81","size":"0.06"},{"price":"10840.09","size":"0.01"},{"price":"10840.11","size":"0.08"},{"price":"10842.20","size":"0.50"},{"price":"10842.25","size":"0.03"},{"price":"10842.89","size":"0.06"},{"price":"10848.75","size":"0.05"},{"price":"10852.20","size":"0.04"},{"price":"10854.22","size":"2.00"},{"price":"10854.26","size":"0.04"},{"price":"10854.73","size":"1.98"},{"price":"10854.90","size":"0.04"},{"price":"10854.91","size":"0.01"},{"price":"10855.02","size":"0.10"},{"price":"10855.19","size":"0.91"},{"price":"10855.35","size":"3.82"},{"price":"10855.91","size":"0.01"},{"price":"10856.36","size":"0.20"},{"price":"10856.64","size":"0.20"},{"price":"10856.67","size":"5.86"},{"price":"10856.91","size":"0.01"},{"price":"10857.91","size":"0.01"},{"price":"10858.90","size":"0.04"},{"price":"10858.91","size":"0.01"},{"price":"10859.39","size":"0.40"},{"price":"10859.91","size":"0.01"},{"price":"10860.07","size":"0.40"},{"price":"10860.83","size":"0.04"},{"price":"10860.84","size":"0.50"},{"price":"10860.91","size":"0.01"},{"price":"10861.91","size":"0.01"},{"price":"10862.94","size":"0.80"},{"price":"10863.46","size":"0.03"},{"price":"10863.98","size":"0.50"},{"price":"10867.61","size":"0.60"},{"price":"10869.58","size":"0.93"},{"price":"10873.04","size":"0.83"},{"price":"10878.91","size":"0.01"},{"price":"10879.91","size":"0.01"},{"price":"10880.55","size":"0.03"},{"price":"10880.91","size":"0.01"},{"price":"10881.91","size":"0.01"},{"price":"10882.32","size":"4.29"},{"price":"10882.91","size":"0.01"},{"price":"10883.91","size":"0.01"},{"price":"10884.91","size":"0.01"},{"price":"10885.44","size":"0.96"},{"price":"10885.91","size":"0.01"},{"price":"10888.00","size":"0.11"},{"price":"10889.03","size":"0.96"},{"price":"10889.91","size":"0.01"},{"price":"10891.76","size":"0.75"},{"price":"10894.89","size":"1.52"},{"price":"10896.51","size":"0.01"},{"price":"10896.52","size":"0.92"},{"price":"10897.52","size":"8.20"},{"price":"10899.91","size":"0.01"},{"price":"10899.92","size":"0.90"},{"price":"10900.30","size":"0.03"},{"price":"10901.62","size":"0.03"},{"price":"10907.42","size":"2.00"},{"price":"10910.80","size":"1.10"},{"price":"10913.12","size":"8.21"},{"price":"10920.15","size":"0.03"},{"price":"10920.16","size":"0.20"},{"price":"10920.67","size":"0.04"},{"price":"10926.44","size":"0.03"},{"price":"10946.42","size":"2.00"},{"price":"10948.03","size":"0.01"},{"price":"10948.07","size":"0.04"},{"price":"10950.47","size":"1.95"},{"price":"10950.78","size":"0.95"},{"price":"10950.95","size":"12.14"},{"price":"10951.54","size":"1.13"},{"price":"10966.11","size":"1.83"},{"price":"10968.96","size":"1.20"},{"price":"10969.70","size":"0.05"},{"price":"10970.36","size":"5.00"},{"price":"10972.23","size":"2.05"},{"price":"10976.85","size":"2.05"},{"price":"10977.77","size":"0.14"},{"price":"10991.28","size":"0.05"},{"price":"10991.63","size":"2.63"},{"price":"10998.10","size":"0.17"},{"price":"11000.00","size":"0.03"},{"price":"11011.01","size":"0.04"},{"price":"11014.29","size":"0.04"},{"price":"11018.20","size":"2.10"},{"price":"11020.00","size":"0.01"}],"bid":[{"price":"10820.19","size":"0.08"},{"price":"10820.18","size":"0.30"},{"price":"10820.14","size":"0.39"},{"price":"10820.00","size":"0.27"},{"price":"10813.46","size":"0.02"},{"price":"10813.45","size":"1.25"},{"price":"10812.79","size":"0.02"},{"price":"10811.40","size":"0.45"},{"price":"10808.67","size":"0.93"},{"price":"10806.48","size":"0.50"},{"price":"10805.90","size":"2.00"},{"price":"10805.86","size":"0.20"},{"price":"10801.34","size":"1.33"},{"price":"10800.51","size":"0.20"},{"price":"10795.33","size":"0.20"},{"price":"10795.32","size":"0.18"},{"price":"10794.19","size":"0.15"},{"price":"10789.84","size":"0.20"},{"price":"10789.51","size":"0.40"},{"price":"10789.32","size":"0.04"},{"price":"10785.04","size":"0.80"},{"price":"10784.62","size":"0.50"},{"price":"10781.64","size":"0.50"},{"price":"10781.62","size":"4.18"},{"price":"10779.62","size":"0.93"},{"price":"10779.54","size":"0.60"},{"price":"10779.25","size":"0.40"},{"price":"10776.62","size":"0.19"},{"price":"10776.53","size":"0.19"},{"price":"10774.12","size":"0.83"},{"price":"10772.27","size":"0.50"},{"price":"10771.81","size":"0.05"},{"price":"10771.80","size":"2.00"},{"price":"10770.77","size":"8.10"},{"price":"10769.60","size":"0.10"},{"price":"10769.59","size":"0.15"},{"price":"10766.18","size":"0.05"},{"price":"10765.52","size":"0.05"},{"price":"10765.51","size":"0.01"},{"price":"10765.00","size":"0.02"},{"price":"10764.70","size":"0.05"},{"price":"10763.88","size":"0.04"},{"price":"10763.48","size":"0.20"},{"price":"10763.47","size":"0.05"},{"price":"10763.32","size":"0.96"},{"price":"10762.21","size":"0.04"},{"price":"10760.77","size":"0.05"},{"price":"10760.76","size":"0.96"},{"price":"10759.92","size":"8.13"},{"price":"10758.01","size":"1.14"},{"price":"10752.47","size":"0.90"},{"price":"10751.58","size":"0.05"},{"price":"10750.00","size":"0.02"},{"price":"10749.91","size":"0.92"},{"price":"10747.16","size":"1.52"},{"price":"10746.99","size":"0.05"},{"price":"10743.26","size":"0.03"},{"price":"10741.62","size":"1.10"},{"price":"10739.07","size":"2.00"},{"price":"10735.81","size":"0.04"},{"price":"10735.78","size":"0.05"},{"price":"10731.54","size":"5.00"},{"price":"10730.00","size":"0.10"},{"price":"10727.38","size":"12.15"},{"price":"10725.46","size":"2.52"},{"price":"10721.70","size":"0.04"},{"price":"10720.30","size":"0.20"},{"price":"10720.00","size":"0.01"},{"price":"10712.73","size":"0.05"},{"price":"10711.90","size":"2.10"},{"price":"10710.51","size":"0.95"},{"price":"10709.11","size":"1.95"},{"price":"10700.00","size":"0.63"},{"price":"10698.46","size":"0.03"},{"price":"10695.34","size":"5.50"},{"price":"10692.69","size":"0.57"},{"price":"10688.80","size":"2.05"},{"price":"10687.42","size":"2.05"},{"price":"10681.36","size":"1.60"},{"price":"10680.39","size":"0.05"},{"price":"10680.00","size":"0.01"},{"price":"10676.83","size":"0.04"},{"price":"10663.25","size":"1.30"},{"price":"10662.50","size":"1.20"},{"price":"10660.00","size":"0.31"},{"price":"10659.18","size":"0.02"},{"price":"10658.85","size":"0.05"},{"price":"10656.23","size":"0.04"},{"price":"10650.00","size":"0.05"},{"price":"10640.00","size":"0.01"},{"price":"10634.55","size":"2.03"},{"price":"10633.45","size":"0.08"},{"price":"10633.27","size":"0.05"},{"price":"10633.19","size":"2.03"},{"price":"10630.00","size":"0.01"},{"price":"10629.63","size":"0.09"},{"price":"10624.44","size":"2.30"},{"price":"10621.38","size":"0.04"},{"price":"10620.00","size":"0.01"},{"price":"10612.12","size":"0.20"}]}
/***** File content bithumb Bitcoin *****/n
{"status":"0000","data":{"timestamp":"1517005194958","payment_currency":"KRW","order_currency":"BTC","bids":[{"quantity":"4.17720000","price":"12657000"},{"quantity":"0.01190000","price":"12646000"},{"quantity":"0.62670000","price":"12645000"},{"quantity":"0.10000000","price":"12644000"},{"quantity":"0.49640000","price":"12643000"},{"quantity":"0.02000000","price":"12642000"},{"quantity":"0.28510000","price":"12641000"},{"quantity":"0.20820000","price":"12635000"},{"quantity":"1.80100000","price":"12633000"},{"quantity":"0.31170000","price":"12631000"},{"quantity":"0.10150000","price":"12622000"},{"quantity":"0.19000000","price":"12618000"},{"quantity":"0.70290000","price":"12616000"},{"quantity":"3.42300000","price":"12600000"},{"quantity":"3.01440000","price":"12599000"},{"quantity":"0.20270000","price":"12598000"},{"quantity":"0.00800000","price":"12592000"},{"quantity":"0.10110000","price":"12590000"},{"quantity":"0.19140000","price":"12589000"},{"quantity":"0.21700000","price":"12587000"}],"asks":[{"quantity":"0.59900000","price":"12664000"},{"quantity":"1.94739053","price":"12667000"},{"quantity":"4.50000000","price":"12676000"},{"quantity":"2.00170000","price":"12701000"},{"quantity":"0.76887214","price":"12703000"},{"quantity":"0.02190000","price":"12704000"},{"quantity":"3.44420000","price":"12705000"},{"quantity":"1.13810000","price":"12708000"},{"quantity":"0.03600000","price":"12713000"},{"quantity":"0.12590000","price":"12720000"},{"quantity":"0.01660000","price":"12725000"},{"quantity":"0.00700000","price":"12729000"},{"quantity":"1.36510000","price":"12735000"},{"quantity":"0.00480000","price":"12738000"},{"quantity":"0.00540000","price":"12739000"},{"quantity":"4.80390000","price":"12745000"},{"quantity":"2.07980000","price":"12747000"},{"quantity":"0.76610000","price":"12750000"},{"quantity":"0.24430000","price":"12755000"},{"quantity":"1.10570000","price":"12758000"}]}}
```

Nicht verwundern je nach Börse kommen unterschiedliche Währungen zum Einsatz (Euro, Dollar und zu letzt südkoreanischer Won). Das Problem ist bei bithumb (letzte Ausgabe) bekomme ich das günstigste Angebot erst nach "asks". Ich lese mich jetzt mal in diese Parser Thematik ein weil eigentlich ist doch dieses JSON String Format standardisiert (nehme ich zumindest an). Problem ist nur wenn ich das betrachte so ganz einheitlich ist die Ausgabe an den verschiedenen Handelsplätzen dann auch wieder nicht. Mal davon abgesehen (bis auf die letzte Ausgabe) brauche ich ja immer nur die erste Zahl im Ticker (also das günstigste Verkaufsangebot) weil mich interessiert ja nur der Spread zwischen den einzelnen Handelsplätzen.


----------



## mrBrown (26. Jan 2018)

Conax hat gesagt.:


> Ich lese mich jetzt mal in diese Parser Thematik ein weil eigentlich ist doch dieses JSON String Format standardisiert (nehme ich zumindest an).


JSON ist standardisiert, das ist allerdings nur das Format, nicht der Inhalt.
Quasi genauso wie JPGs Standardisiert sind, was zu sehen ist, ist trotzdem vollkommen offen 


Du bräuchtest einfach für jede Seite einen eigenen Parser (der intern einen Json-Parser benutzt), der nach außen einfach nur den Wert zurück gibt, den du brauchst.
Ist Objektorientiert ziemlich leicht umzusetzen


----------



## Conax (22. Feb 2018)

```
{"Nonce":0,"Data":[{"Id":-1,"Name":"No payment method","CoinAmount":1,"FiatAmount":8731.09},{"Id":3,"Name":"Bancontact / Mistercash","CoinAmount":1,"FiatAmount":8833.98},{"Id":5,"Name":"Giropay","CoinAmount":1,"FiatAmount":8902.57},{"Id":1,"Name":"iDEAL","CoinAmount":1,"FiatAmount":8731.39},{"Id":7,"Name":"Mybank","CoinAmount":1,"FiatAmount":8881.06},{"Id":4,"Name":"SEPA","CoinAmount":1,"FiatAmount":8774.39},{"Id":2,"Name":"Sofort","CoinAmount":1,"FiatAmount":9073.85},{"Id":10,"Name":"TrustPay","CoinAmount":1,"FiatAmount":8901.62}],"Errors":[],"HasErrors":false}
```


```
public void getValue2() {
        try
        {

            URL url30 = new URL("https", "api.anycoindirect.eu",
                    "/api/public/buyprices?CoinCode=BTC&FiatCode=EUR&CoinAmount=1");

            try (BufferedReader in = new BufferedReader(new InputStreamReader(url30.openStream())))
            {
                String inputLine;

               
                System.out.println("/***** File content Bitcoin *****/n");
                while ((inputLine = in.readLine()) != null)
                {
                    System.out.println(inputLine);
                   
                    JSONParser parser = new JSONParser();
                    JSONObject obj2 = (JSONObject) parser.parse(inputLine);

               

                }
            } catch (IOException ioe)
            {
                ioe.printStackTrace(System.err);
            } catch (ParseException e)
            {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        } catch (MalformedURLException mue)
        {
            mue.printStackTrace(System.err);
        }
    }
```

Hab mich jetzt nach folgender Anleitung gerichtet:
https://examples.javacodegeeks.com/core-java/json/java-json-parser-example/


```
double fiatamount =  (double) obj2.get("FiatAmount");
System.out.println("The fiatamount is: " + fiatamount);
```

Irgendwie funktioniert das so nicht. Irgendwie steh ich voll aufm Schlauch ist auch jetzt schon die zweite JSON Library die ich ausprobiere.


----------



## mrBrown (22. Feb 2018)

In den seltensten Fällen führt sinnfreies Ausprobieren zu irgendeiner Lösung...

Den relevanten Teil aus dieser Anleitung hast du weggelassene - das iterieren über die Liste.


----------



## Conax (22. Feb 2018)

@mrBrown
_


mrBrown hat gesagt.:



			In den seltensten Fällen führt sinnfreies Ausprobieren zu irgendeiner Lösung...

Den relevanten Teil aus dieser Anleitung hast du weggelassene - das iterieren über die Liste.
		
Zum Vergrößern anklicken....


Ja da gebe ich dir völlig recht zum Schluss war es einfach nur noch ein sinnfreies Ausprobieren - man erkennt denke ich auch an der Uhrzeit das es schon recht spät war.

Anyway danke für das aufzeigen der richtigen Richtung habe den Code mal angepasst und die Ausgabe gefällt mir schon deutlich besser.



		Code:In die Zwischenablage kopieren


public void getValue2() {
        try
        {

            URL url30 = new URL("https", "api.anycoindirect.eu",
                    "/api/public/buyprices?CoinCode=BTC&FiatCode=EUR&CoinAmount=1");

            try (BufferedReader in = new BufferedReader(new InputStreamReader(url30.openStream())))
            {
                String inputLine;

                System.out.println("/***** File content Bitcoin *****/n");
                while ((inputLine = in.readLine()) != null)
                {
                    System.out.println(inputLine);

                    JSONParser parser = new JSONParser();
                    JSONObject obj2 = (JSONObject) parser.parse(inputLine);

                    // double fiatamount = (double) obj2.get("FiatAmount");
                    // System.out.println("The fiatamount is: " + fiatamount);
                    JSONArray lang = (JSONArray) obj2.get("Data");
                    Iterator i = lang.iterator();

                    while (i.hasNext())
                    {
                        JSONObject innerObj = (JSONObject) i.next();
                        System.out.println(
                                "Id " + innerObj.get("Id") + " with Fiat Amount " + innerObj.get("FiatAmount"));
                    }

                }
            } catch (IOException ioe)
            {
                ioe.printStackTrace(System.err);
            } catch (ParseException e)
            {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        } catch (MalformedURLException mue)
        {
            mue.printStackTrace(System.err);
        }
    }


Verständnishalber mal ein paar Fragen (weil dieses Tutorial schön und gut aber so ganz hab ich das noch nicht durchdrungen was da eigentlich passiert). 
Der Aufbau ist doch ungefähr so:
"Data":[{Element1},{Element2}, .... ]

Was ich hier gemacht habe ist das ich diesen ganzen JSON String erstmal zu einem JSON Objekt erzeugt habe ("obj2"). Dann habe ich gesagt der ganze Kram davor und danch interessiert mich nicht also nur der Inhalt in den [] Klammern und habe deshalb ein JSON Array angelegt ("lang" - hab das einfach so vom Tutorial übernommen). Dann habe ich einen Iterator (Zeiger) angelegt der über das JSON Array ("lang") geht - also der Zeiger quasi sich wohl innerhalb dieser [] Klammern bewegt und mit der Methode i.next() jeweils dann auf das jeweilige Element zeigt (angefangen links bei Element1 dann Element2 ... usw.). Das eigentliche auslesen passiert aber erst mit der Methode jsonobject.get("FiatAmount") aber dadurch das ich vorher mit dem Iterator quasi eingegrenzt habe wo ausgelesen werden muss funktioniert das ganze. Habe ich das soweit richtig verstanden?
_


----------



## mrBrown (22. Feb 2018)

Conax hat gesagt.:


> Anyway danke für das aufzeigen der richtigen Richtung habe den Code mal angepasst und die Ausgabe gefällt mir schon deutlich besser.


Du kannst dem Parser direkt den BufferedReader übergeben.
Mit dem bisherigen Zeilenweisen parsen wirst du in jedem Fall Probleme bekommen.



Conax hat gesagt.:


> _Verständnishalber mal ein paar Fragen (weil dieses Tutorial schön und gut aber so ganz hab ich das noch nicht durchdrungen was da eigentlich passiert).
> Der Aufbau ist doch ungefähr so:
> "Data":[{Element1},{Element2}, .... ]
> 
> Was ich hier gemacht habe ist das ich diesen ganzen JSON String erstmal zu einem JSON Objekt erzeugt habe ("obj2"). Dann habe ich gesagt der ganze Kram davor und danch interessiert mich nicht also nur der Inhalt in den [] Klammern und habe deshalb ein JSON Array angelegt ("lang" - hab das einfach so vom Tutorial übernommen). Dann habe ich einen Iterator (Zeiger) angelegt der über das JSON Array ("lang") geht - also der Zeiger quasi sich wohl innerhalb dieser [] Klammern bewegt und mit der Methode i.next() jeweils dann auf das jeweilige Element zeigt (angefangen links bei Element1 dann Element2 ... usw.). Das eigentliche auslesen passiert aber erst mit der Methode jsonobject.get("FiatAmount") aber dadurch das ich vorher mit dem Iterator quasi eingegrenzt habe wo ausgelesen werden muss funktioniert das ganze. Habe ich das soweit richtig verstanden?_


Ja, grob passt das.
`lang` kannst du als einfache Liste von JsonValue sehen und genauso wie jede andere Liste in Java auch benutzen.
Statt Iterator empfiehlt sich ein einfaches for-each


----------



## Conax (31. Mrz 2018)

So erstmal danke für eure Hilfe. Ich hab das ganze jetzt erstmal so wie ich es brauche. Das große Problem was ich aktuell habe ist das auslesen der Tabelle in Java FX. Ich versteh nicht warum der Tabelleninhalt leer ist sprich warum die Kurse nicht ausgegeben werden.


```
package virtualcurrencymonitor;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.Iterator;

import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;

import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuBar;
import javafx.scene.control.MenuItem;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.stage.Stage;

public class Monitor extends Application {

    private TableView<Marktplatz> table = new TableView<>();

    ComboBox<String> currenciebox = new ComboBox();
    ComboBox<String> hardwarebox = new ComboBox();

    double anycoinbtc = 0;
    double anycoineth = 0;
    double anycoinltc = 0;
    double anycoinxmr = 0;
    double anycoindash = 0;

   

    // json reader anfang
    // https://stackoverflow.com/questions/4308554/simplest-way-to-read-json-from-a-url-in-java
    // https://mvnrepository.com/artifact/org.json/json
    /*
     * private static String readAll(Reader rd) throws IOException {
     * StringBuilder sb = new StringBuilder(); int cp; while ((cp = rd.read())
     * != -1) { sb.append((char) cp); } return sb.toString(); }
     *
     * public static JSONObject readJsonFromUrl(String url) throws IOException,
     * JSONException { InputStream is = new URL(url).openStream(); try {
     * BufferedReader rd = new BufferedReader(new InputStreamReader(is,
     * Charset.forName("UTF-8"))); String jsonText = readAll(rd); JSONObject
     * json = new JSONObject(jsonText); return json; } finally { is.close(); } }
     */
    // json reader ende

    public void getValue() {
        try
        {
           

            // für Bitcoin
            URL url1 = new URL("https", "anycoindirect.eu",
                    "/api/public/buyprices?CoinCode=BTC&FiatCode=EUR&CoinAmount=1");

            // für Ethereum
            URL url2 = new URL("https", "anycoindirect.eu",
                    "/api/public/buyprices?CoinCode=ETH&FiatCode=EUR&CoinAmount=1");

            // für Litecoin
            URL url3 = new URL("https", "anycoindirect.eu",
                    "/api/public/buyprices?CoinCode=LTC&FiatCode=EUR&CoinAmount=1");

            // für Monero
            URL url4 = new URL("https", "anycoindirect.eu",
                    "/api/public/buyprices?CoinCode=XMR&FiatCode=EUR&CoinAmount=1");

            // für Dash
            URL url5 = new URL("https", "anycoindirect.eu",
                    "/api/public/buyprices?CoinCode=DASH&FiatCode=EUR&CoinAmount=1");

           

            // System.out.println("Bitcoin: " + url1.toString() + "\n");
            // System.out.println("Monero: " + url5.toString() + "\n");
            // System.out.println("Litecoin: " + url6.toString() + "\n");
            // System.out.println("Monero Difficulty & Block reward: " +
            // url7.toString() + "\n");

            System.setProperty("http.agent", "Chrome2");
            // Open URL stream as an input stream and print contents to command
            // line

            try (BufferedReader in = new BufferedReader(new InputStreamReader(url1.openStream())))
            {
                String inputLine;

                // Read the "gpl.txt" text file from its URL representation
                System.out.println("/***** File content Bitcoin *****/n");
                while ((inputLine = in.readLine()) != null)
                {
                    // System.out.println(inputLine);

                    JSONParser parser = new JSONParser();
                    JSONObject obj2 = (JSONObject) parser.parse(inputLine);

                    // double fiatamount = (double) obj2.get("FiatAmount");
                    // System.out.println("The fiatamount is: " + fiatamount);
                    JSONArray lang = (JSONArray) obj2.get("Data");
                    // @SuppressWarnings("rawtypes")
                    Iterator i = lang.iterator();

                    while (i.hasNext())
                    {
                        JSONObject innerObj = (JSONObject) i.next();
                        // System.out.println("Id " + innerObj.get("Id") + "
                        // with Fiat Amount " + innerObj.get("FiatAmount"));
                        System.out.println(innerObj.get("FiatAmount"));
                        anycoinbtc = (double) innerObj.get("FiatAmount");
                        break;
                    }
                }
            } catch (ParseException e)
            {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IOException ioe)
            {
                ioe.printStackTrace(System.err);
            }

            try (BufferedReader in = new BufferedReader(new InputStreamReader(url2.openStream())))
            {
                String inputLine;

                // Read the "gpl.txt" text file from its URL representation
                System.out.println("/***** File content Ethereum *****/n");
                while ((inputLine = in.readLine()) != null)
                {
                    // System.out.println(inputLine);

                    JSONParser parser = new JSONParser();
                    JSONObject obj2 = (JSONObject) parser.parse(inputLine);

                    // double fiatamount = (double) obj2.get("FiatAmount");
                    // System.out.println("The fiatamount is: " + fiatamount);
                    JSONArray lang = (JSONArray) obj2.get("Data");
                    // @SuppressWarnings("rawtypes")
                    Iterator i = lang.iterator();

                    while (i.hasNext())
                    {
                        JSONObject innerObj = (JSONObject) i.next();
                        // System.out.println("Id " + innerObj.get("Id") + "
                        // with Fiat Amount " + innerObj.get("FiatAmount"));
                        System.out.println(innerObj.get("FiatAmount"));
                        anycoineth = (double) innerObj.get("FiatAmount");
                        break;
                    }
                }
            } catch (ParseException e)
            {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IOException ioe)
            {
                ioe.printStackTrace(System.err);
            }

            try (BufferedReader in = new BufferedReader(new InputStreamReader(url3.openStream())))
            {
                String inputLine;

                // Read the "gpl.txt" text file from its URL representation
                System.out.println("/***** File content Litecoin *****/n");
                while ((inputLine = in.readLine()) != null)
                {
                    // System.out.println(inputLine);

                    JSONParser parser = new JSONParser();
                    JSONObject obj2 = (JSONObject) parser.parse(inputLine);

                    // double fiatamount = (double) obj2.get("FiatAmount");
                    // System.out.println("The fiatamount is: " + fiatamount);
                    JSONArray lang = (JSONArray) obj2.get("Data");
                    // @SuppressWarnings("rawtypes")
                    Iterator i = lang.iterator();

                    while (i.hasNext())
                    {
                        JSONObject innerObj = (JSONObject) i.next();
                        // System.out.println("Id " + innerObj.get("Id") + "
                        // with Fiat Amount " + innerObj.get("FiatAmount"));
                        System.out.println(innerObj.get("FiatAmount"));
                        anycoinltc = (double) innerObj.get("FiatAmount");
                        break;
                    }
                }
            } catch (ParseException e)
            {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IOException ioe)
            {
                ioe.printStackTrace(System.err);
            }

            try (BufferedReader in = new BufferedReader(new InputStreamReader(url4.openStream())))
            {
                String inputLine;

                // Read the "gpl.txt" text file from its URL representation
                System.out.println("/***** File content Monero *****/n");
                while ((inputLine = in.readLine()) != null)
                {
                    // System.out.println(inputLine);

                    JSONParser parser = new JSONParser();
                    JSONObject obj2 = (JSONObject) parser.parse(inputLine);

                    // double fiatamount = (double) obj2.get("FiatAmount");
                    // System.out.println("The fiatamount is: " + fiatamount);
                    JSONArray lang = (JSONArray) obj2.get("Data");
                    // @SuppressWarnings("rawtypes")
                    Iterator i = lang.iterator();

                    while (i.hasNext())
                    {
                        JSONObject innerObj = (JSONObject) i.next();
                        // System.out.println("Id " + innerObj.get("Id") + "
                        // with Fiat Amount " + innerObj.get("FiatAmount"));
                        System.out.println(innerObj.get("FiatAmount"));
                        anycoinxmr = (double) innerObj.get("FiatAmount");
                        break;
                    }
                }
            }

            catch (ParseException e)
            {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IOException ioe)
            {
                ioe.printStackTrace(System.err);
            }

            try (BufferedReader in = new BufferedReader(new InputStreamReader(url5.openStream())))
            {
                String inputLine;

                // Read the "gpl.txt" text file from its URL representation
                System.out.println("/***** File content DASH *****/n");
                while ((inputLine = in.readLine()) != null)
                {
                    // System.out.println(inputLine);

                    JSONParser parser = new JSONParser();
                    JSONObject obj2 = (JSONObject) parser.parse(inputLine);

                    // double fiatamount = (double) obj2.get("FiatAmount");
                    // System.out.println("The fiatamount is: " + fiatamount);
                    JSONArray lang = (JSONArray) obj2.get("Data");
                    // @SuppressWarnings("rawtypes")
                    Iterator i = lang.iterator();

                    while (i.hasNext())
                    {
                        JSONObject innerObj = (JSONObject) i.next();
                        // System.out.println("Id " + innerObj.get("Id") + "
                        // with Fiat Amount " + innerObj.get("FiatAmount"));
                        System.out.println(innerObj.get("FiatAmount"));
                        anycoindash = (double) innerObj.get("FiatAmount");
                        break;
                    }
                }
            } catch (ParseException e)
            {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IOException ioe)
            {
                ioe.printStackTrace(System.err);
            }

           

        }

        catch (MalformedURLException mue)
        {
            mue.printStackTrace(System.err);
        }

    }

   

    public static void main(String[] args) throws IOException {
       

        // URL url30 = new URL("https", "api.anycoindirect.eu",
        // "/api/public/buyprices?CoinCode=BTC&FiatCode=EUR&CoinAmount=1");

        // String bcjson = null;

        // JSONObject obj = new JSONObject(bcjson);
        // String versuch = obj.getString("Nonce");
        // JSONArray arr = obj.getJSONArray("Nonce");

        Monitor monitor1 = new Monitor();
        monitor1.getValue();
        /*
         NumberFormat numberFormat = new DecimalFormat("0.00");
         * monitor1.getValue2(); monitor1.getValue();
         * System.out.println(monitor1.anycoinbtc);
         *
         * // so funktionierts so bekomme ich mein Wunschformat
         System.out.println(numberFormat.format(monitor1.anycoinbtc));
        

        launch();

    }

   
   
    public void start(Stage teststage) {
        MenuBar menubar = new MenuBar();
        Menu mfile = new Menu("Datei");
        Menu mhelp = new Menu("?");

        menubar.getMenus().addAll(mfile, mhelp);

        MenuItem showmarket = new MenuItem("aktuelle Kurse anzeigen");
        MenuItem calculator = new MenuItem("mining Rechner");
        MenuItem exit = new MenuItem("Exit");
        MenuItem about = new MenuItem("Info");

        mfile.getItems().addAll(showmarket, calculator, exit);
        mhelp.getItems().addAll(about);

        exit.setOnAction(new EventHandler<ActionEvent>() {
            public void handle(ActionEvent t) {
                System.exit(0);
            }
        });

        VBox hb1 = new VBox();

        hb1.getChildren().addAll(menubar);
        hb1.setSpacing(10);

        HBox box1 = new HBox();
        HBox box2 = new HBox();
        box1.getChildren().add(iv1);
        box2.getChildren().add(iv2);
        // Pane gibt an wie das Layout gestaltet sein soll
        BorderPane pane = new BorderPane();

        pane.setTop(hb1);
        pane.setCenter(box1);
        pane.setBottom(box2);

        Stage stage1 = new Stage();
        Scene scene1 = new Scene(new Group());
        Stage stage2 = new Stage();
        Scene scene2 = new Scene(new Group());
        Stage stage3 = new Stage();
        Scene scene3 = new Scene(new Group());

        showmarket.setOnAction(new EventHandler<ActionEvent>() {
            public void handle(ActionEvent event) {

                stage1.setTitle("aktuelle Kurse");
                stage1.setWidth(1100);
                stage1.setHeight(500);

                final Label label = new Label("günstigste Einkaufspreise");
                label.setFont(new Font("Arial", 20));

                table.setEditable(true);

                NumberFormat numberFormat = new DecimalFormat("0.00");
                final ObservableList<Marktplatz> data = FXCollections.observableArrayList(
                        new Marktplatz("Anycoin Direct", numberFormat.format(anycoinbtc).toString(),
                                numberFormat.format(anycoineth).toString(), "null", "null",
                                numberFormat.format(anycoinltc).toString(), numberFormat.format(anycoinxmr).toString(),
                                numberFormat.format(anycoindash).toString()));

                TableColumn<Marktplatz, String> HandelNameCol = new TableColumn<>("Marktplatzname");
                TableColumn<Marktplatz, String> BitcoinCol = new TableColumn<>("Bitcoin");
                TableColumn<Marktplatz, String> EtherCol = new TableColumn<>("Etherium");
                TableColumn<Marktplatz, String> RippleCol = new TableColumn<>("Ripple");
                TableColumn<Marktplatz, String> BtCashCol = new TableColumn<>("Bitcoin Cash");
                TableColumn<Marktplatz, String> LitecoinCol = new TableColumn<>("Litecoin");
                TableColumn<Marktplatz, String> MoneroCol = new TableColumn<>("Monero");
                TableColumn<Marktplatz, String> DashCol = new TableColumn<>("Dash");

                HandelNameCol.setCellValueFactory(new PropertyValueFactory<Marktplatz, String>("mplatzname"));
                BitcoinCol.setCellValueFactory(new PropertyValueFactory<Marktplatz, String>("bcbetrag"));
                EtherCol.setCellValueFactory(new PropertyValueFactory<Marktplatz, String>("ethbetrag"));
                RippleCol.setCellValueFactory(new PropertyValueFactory<Marktplatz, String>("xrpbetrag"));
                BtCashCol.setCellValueFactory(new PropertyValueFactory<Marktplatz, String>("bchbetrag"));
                LitecoinCol.setCellValueFactory(new PropertyValueFactory<Marktplatz, String>("ltcbetrag"));
                MoneroCol.setCellValueFactory(new PropertyValueFactory<Marktplatz, String>("xmrbetrag"));
                DashCol.setCellValueFactory(new PropertyValueFactory<Marktplatz, String>("dashbetrag"));

                table.setItems(data);

                if (table.getColumns().isEmpty())
                {
                    table.getColumns().addAll(HandelNameCol, BitcoinCol, EtherCol, RippleCol, BtCashCol, LitecoinCol,
                            MoneroCol, DashCol);
                }

                final VBox vbox = new VBox();
                vbox.setSpacing(5);
                vbox.setPadding(new Insets(10, 0, 0, 10));
                vbox.getChildren().addAll(label, table);

                ((Group) scene1.getRoot()).getChildren().addAll(vbox);

                stage1.setScene(scene1);
                stage1.show();
            }
        });

        calculator.setOnAction(new EventHandler<ActionEvent>() {
            public void handle(ActionEvent event) {

                stage2.show();
                stage2.setTitle("Miningkosten berechnen");
                stage2.setWidth(600);
                stage2.setHeight(500);

                GridPane pane2 = new GridPane();
                Scene scene2 = new Scene(pane2, 200, 350);
                stage2.setScene(scene2);
                stage2.show();
                pane2.setHgap(10);
                pane2.setVgap(10);
                pane2.setPadding(new Insets(10, 10, 10, 10));

                Text selectcurrencie = new Text("Währung auswählen:");
                pane2.add(selectcurrencie, 0, 0);
                Text selecthardware = new Text("Hardware auswählen:");
                pane2.add(selecthardware, 0, 1);
                Text powerprice = new Text("Strompreis der kWh angeben:");
                pane2.add(powerprice, 0, 2);
                Text miningprofit = new Text("Ergebnis:");
                pane2.add(miningprofit, 0, 3);
                TextField tfpowerprice = new TextField();
                pane2.add(tfpowerprice, 1, 2);
                tfpowerprice.getText();
                pane2.add(currenciebox, 1, 0);
                pane2.add(hardwarebox, 1, 1);

                // hier sagen wir was die Auswahlliste beinhalten soll
                currenciebox.getItems().addAll("Bitcoin", "Ethereum", "Litecoin", "Dash", "Monero");
                hardwarebox.getItems().addAll("AMD R9 290", "Intel i5-6200U");

                // Daten von hier übernommen
                // https://whattomine.com/coins/151-eth-ethash
                long monerodifficulty = 30300914325L;
                double moneroblockreward = 6.009976305957;
                long bitcoindifficulty = 1452839779146L;
                double bitcoinblockreward = 12.5;
                long ethereumdifficulty = 1520843345921538L;
                double ethereumblockreward = 3;
                long litecoindifficulty = 1081815L;
                double litecoinblockreward = 25;
                long dashdifficulty = 17149753L;
                double dashblockreward = 1.80;

                // ripple kann nicht gemint werden
                // Formel für die Anzahl der generierten Moneros pro Stunde
                // Profit = ((hashrate * block_reward) / current_difficulty) *
                // (1 - pool_fee) * 3600

            }
        });

        about.setOnAction(new EventHandler<ActionEvent>() {
            public void handle(ActionEvent event) {

                stage3.show();
                stage3.setTitle("Credits");
                stage3.setWidth(600);
                stage3.setHeight(500);

            }
        });

        // in dem Fall wohl eine Art brnach node weil ein StackPane beispiel
        // darunter ist
        Scene sceneone = new Scene(pane, 300, 250);

        teststage.setScene(sceneone);

        teststage.setTitle("Virtual Currency Monitor");
        // wird benötigt am das Fenster sichtbar zu machen selbe wie set
        // visible(true) bei swing
        teststage.show();
    }

    public static class Marktplatz {

        String mplatzname = null;
        String bcbetrag = null;
        String ethbetrag = null;
        String xrpbetrag = null;
        String bchbetrag = null;
        String ltcbetrag = null;
        String xmrbetrag = null;
        String dashbetrag = null;

        private Marktplatz(String mplatzname, String bcbetrag, String ethbetrag, String xrpbetrag, String bchbetrag,
                String ltcbetrag, String xmrbetrag, String dashbetrag) {
            this.mplatzname = mplatzname;
            this.bcbetrag = bcbetrag;
            this.ethbetrag = ethbetrag;
            this.xrpbetrag = xrpbetrag;
            this.bchbetrag = bchbetrag;
            this.ltcbetrag = ltcbetrag;
            this.xmrbetrag = xmrbetrag;
            this.dashbetrag = dashbetrag;

        }

        public String getMplatzName() {
            return mplatzname;
        }

        public String getBcBetrag() {
            return bcbetrag;
        }

        public String getEthBetrag() {
            return ethbetrag;
        }

        public String getXrpBetrag() {
            return xrpbetrag;
        }

        public String getBchBetrag() {
            return bchbetrag;
        }

        public String getLtcBetrag() {
            return ltcbetrag;
        }

        public String getXmrBetrag() {
            return xmrbetrag;
        }

        public String getDashBetrag() {
            return dashbetrag;
        }

        public void setMplatzName(String mplatzname) {
            this.mplatzname = mplatzname;
        }

        public void setBcBetrag(String bcbetrag) {
            this.bcbetrag = bcbetrag;
        }

        public void setEthBetrag(String ethbetrag) {
            this.ethbetrag = ethbetrag;
        }

        public void setXrpBetrag(String xrpbetrag) {
            this.xrpbetrag = xrpbetrag;
        }

        public void setBchBetrag(String bchbetrag) {
            this.bchbetrag = bchbetrag;
        }

        public void setLtcBetrag(String ltcbetrag) {
            this.ltcbetrag = ltcbetrag;
        }

        public void setXmrBetrag(String xmrbetrag) {
            this.xmrbetrag = xmrbetrag;
        }

        public void setDashBetrag(String dashbetrag) {
            this.dashbetrag = dashbetrag;
        }

    }

}
```

Der Code ist schon etwas gekürzt weil beim Originalcode hole ich mir von ingesamt 6 Marktplätzen das günstigste Angebot + die aktuellen Währungskurse aber der Übersicht halber habe ich es mal auf das Wesentliche reduziert - ist denke ich so schon nicht einfach die Übersicht zu behalten. Jedenfalls hab ich mich nach dieser Anleitung gerichtet: https://docs.oracle.com/javafx/2/ui_controls/table-view.htm

Naja ich weiß einfach nicht wo der Fehler ist sprich warum ich in der Tabelle keine Kurse nach dem Muster "0.00" angezeigt bekomme?


----------



## Conax (1. Apr 2018)

Hat sich erledigt Beitrag kann gelöscht werden!


----------

