0

Aktienkurs-Abfrage per API im json-Format

Liebes Forum,

habe folgendes Problem.

Ich rufe per API Aktienkurse zu einer Aktie ab (100 Datensätze in der Rückgabe). Dies funktioniert auch hervorragend. Ich möchte das Ergebnis nun in eine Tabelle Kurse reinschreiben, dies funktioniert bis zum DS-Nr. 51, danach „läuft“ die Schleife anscheinend unendlich, obwohl eigentlich noch 49 DS folgen sollten. Ich bekomme leider auch keine Fehlermeldung, so dass ich nicht weiß, wo ich ansätzen kann/ soll.

Bei 29.01.2019 und (Timer-Nr. 51) bleibt das Programm "stehen". Hilft nur noch hard zu beenden. Das ganze läuft auf einem ipad pro mit der ios-app von ninox.

Vielleicht kann ja jemand helfen oder hat einen Tipp, danke schon mal.

Gruß

Mirko

 

API-Result:

{"result":{"Meta Data":{"1. Information":"Daily Prices (open, high, low, close) and Volumes","2. Symbol":"vktx","3. Last Refreshed":"2019-03-22","4. Output Size":"Compact","5. Time Zone":"US/Eastern"},"Time Series (Daily)":{"2019-03-22":{"1. open":"9.1600","2. high":"9.2600","3. low":"8.2500","4. close":"8.2600","5. volume":"3944350"},"2019-03-21":{"1. open":"8.2400","2. high":"9.3700","3. low":"8.2400","4. close":"9.2800","5. volume":"5947873"},"2019-03-20":{"1. open":"8.6000","2. high":"8.8200","3. low":"8.2500","4. close":"8.2700","5. volume":"2770845"},"2019-03-19":{"1. open":"8.5500","2. high":"8.7300","3. low":"8.3164","4. close":"8.6200","5. volume":"2463574"},"2019-03-18":{"1. open":"7.9000","2. high":"8.5000","3. low":"7.7800","4. close":"8.5000","5. volume":"4112483"},"2019-03-15":{"1. open":"7.7300","2. high":"7.8600","3. low":"7.6450","4. close":"7.8600","5. volume":"2924953"},"2019-03-14":{"1. open":"8.0600","2. high":"8.0961","3. low":"7.5100","4. close":"7.7200","5. volume":"5235673"},"2019-03-13":{"1. open":"8.0300","2. high":"8.3300","3. low":"7.9214","4. close":"8.2500","5. volume":"2706227"},"2019-03-12":{"1. open":"7.9400","2. high":"8.0900","3. low":"7.7500","4. close":"7.9800","5. volume":"1695046"},"2019-03-11":{"1. open":"7.7400","2. high":"7.9800","3. low":"7.5000","4. close":"7.9400","5. volume":"2494610"},"2019-03-08":{"1. open":"7.4200","2. high":"7.8800","3. low":"7.3600","4. close":"7.6700","5. volume":"3016352"},"2019-03-07":{"1. open":"8.1500","2. high":"8.1699","3. low":"7.5100","4. close":"7.5900","5. volume":"4361916"},"2019-03-06":{"1. open":"8.6100","2. high":"8.7600","3. low":"8.1300","4. close":"8.1500","5. volume":"2718591"},"2019-03-05":{"1. open":"8.6900","2. high":"8.9200","3. low":"8.5000","4. close":"8.5500","5. volume":"2457349"},"2019-03-04":{"1. open":"8.8000","2. high":"9.0000","3. low":"8.4400","4. close":"8.7000","5. volume":"2108207"},"2019-03-01":{"1. open":"8.4600","2. high":"8.7800","3. low":"8.4000","4. close":"8.7700","5. volume":"2448398"},"2019-02-28":{"1. open":"8.8600","2. high":"8.8600","3. low":"8.4000","4. close":"8.4100","5. volume":"1805714"},"2019-02-27":{"1. open":"8.4600","2. high":"8.9300","3. low":"8.3370","4. close":"8.7800","5. volume":"2244247"},"2019-02-26":{"1. open":"8.5300","2. high":"8.6700","3. low":"8.4300","4. close":"8.4900","5. volume":"1839863"},"2019-02-25":{"1. open":"8.2100","2. high":"8.6300","3. low":"8.2005","4. close":"8.6100","5. volume":"3033981"},"2019-02-22":{"1. open":"8.5600","2. high":"8.6620","3. low":"8.0500","4. close":"8.2200","5. volume":"3618640"},"2019-02-21":{"1. open":"8.7100","2. high":"8.7800","3. low":"8.5700","4. close":"8.6000","5. volume":"1619401"},"2019-02-20":{"1. open":"9.0300","2. high":"9.1300","3. low":"8.5500","4. close":"8.7700","5. volume":"3265166"},"2019-02-19":{"1. open":"9.4600","2. high":"9.5000","3. low":"8.5300","4. close":"9.0300","5. volume":"7051809"},"2019-02-15":{"1. open":"9.0300","2. high":"9.2438","3. low":"8.8300","4. close":"9.0700","5. volume":"3315710"},"2019-02-14":{"1. open":"8.7600","2. high":"9.1000","3. low":"8.5200","4. close":"9.0600","5. volume":"3482871"},"2019-02-13":{"1. open":"9.0000","2. high":"9.0500","3. low":"8.5900","4. close":"8.8200","5. volume":"3773026"},"2019-02-12":{"1. open":"8.7100","2. high":"9.3500","3. low":"8.5100","4. close":"8.9700","5. volume":"12365745"},"2019-02-11":{"1. open":"7.9800","2. high":"8.2000","3. low":"7.9000","4. close":"8.1100","5. volume":"1811744"},"2019-02-08":{"1. open":"7.8500","2. high":"8.0000","3. low":"7.7000","4. close":"7.9800","5. volume":"1428841"},"2019-02-07":{"1. open":"7.9900","2. high":"8.0500","3. low":"7.8590","4. close":"7.9000","5. volume":"1876313"},"2019-02-06":{"1. open":"8.0200","2. high":"8.0900","3. low":"7.8100","4. close":"8.0300","5. volume":"1806430"},"2019-02-05":{"1. open":"8.3100","2. high":"8.5050","3. low":"7.9400","4. close":"7.9900","5. volume":"3268801"},"2019-02-04":{"1. open":"8.2500","2. high":"8.3200","3. low":"8.0300","4. close":"8.3100","5. volume":"1775599"},"2019-02-01":{"1. open":"8.1800","2. high":"8.2900","3. low":"8.0900","4. close":"8.2300","5. volume":"1349638"},"2019-01-31":{"1. open":"8.3200","2. high":"8.5050","3. low":"8.0400","4. close":"8.1600","5. volume":"2649791"},"2019-01-30":{"1. open":"7.9700","2. high":"8.3600","3. low":"7.9200","4. close":"8.3300","5. volume":"2319675"},"2019-01-29":{"1. open":"8.0700","2. high":"8.1700","3. low":"7.8300","4. close":"7.9200","5. volume":"2291798"},"2019-01-28":{"1. open":"8.2800","2. high":"8.4690","3. low":"8.0200","4. close":"8.0600","5. volume":"2245199"},"2019-01-25":{"1. open":"8.4700","2. high":"8.4989","3. low":"8.1100","4. close":"8.2600","5. volume":"2302500"},"2019-01-24":{"1. open":"8.0900","2. high":"8.4501","3. low":"8.0000","4. close":"8.4500","5. volume":"1795531"},"2019-01-23":{"1. open":"8.2100","2. high":"8.3800","3. low":"8.0000","4. close":"8.0900","5. volume":"1618779"},"2019-01-22":{"1. open":"8.6900","2. high":"8.7200","3. low":"7.9000","4. close":"8.1100","5. volume":"4072019"},"2019-01-18":{"1. open":"8.3500","2. high":"8.8000","3. low":"8.2614","4. close":"8.7800","5. volume":"2200054"},"2019-01-17":{"1. open":"8.2000","2. high":"8.4827","3. low":"8.0600","4. close":"8.2800","5. volume":"2498167"},"2019-01-16":{"1. open":"8.5600","2. high":"9.0400","3. low":"7.9500","4. close":"8.0000","5. volume":"3986922"},"2019-01-15":{"1. open":"8.4000","2. high":"8.5400","3. low":"8.2200","4. close":"8.5200","5. volume":"1651160"},"2019-01-14":{"1. open":"8.3000","2. high":"8.7500","3. low":"8.1200","4. close":"8.3300","5. volume":"1924327"},"2019-01-11":{"1. open":"8.2000","2. high":"8.4900","3. low":"8.1000","4. close":"8.3200","5. volume":"1477986"},"2019-01-10":{"1. open":"8.3500","2. high":"8.3729","3. low":"8.0500","4. close":"8.2300","5. volume":"2546057"},"2019-01-09":{"1. open":"8.5000","2. high":"8.6600","3. low":"8.3200","4. close":"8.4100","5. volume":"1848982"},"2019-01-08":{"1. open":"8.8100","2. high":"8.8556","3. low":"7.8800","4. close":"8.5200","5. volume":"3207229"},"2019-01-07":{"1. open":"8.3000","2. high":"8.8496","3. low":"8.2000","4. close":"8.5900","5. volume":"3154116"},"2019-01-04":{"1. open":"7.7400","2. high":"8.2800","3. low":"7.6500","4. close":"8.2500","5. volume":"3126226"},"2019-01-03":{"1. open":"8.2700","2. high":"8.4300","3. low":"7.5500","4. close":"7.5800","5. volume":"3537594"},"2019-01-02":{"1. open":"7.4000","2. high":"8.3900","3. low":"7.4000","4. close":"8.3200","5. volume":"3362339"},"2018-12-31":{"1. open":"7.7200","2. high":"7.9400","3. low":"7.4266","4. close":"7.6500","5. volume":"3586916"},"2018-12-28":{"1. open":"7.3100","2. high":"7.8000","3. low":"7.1794","4. close":"7.5700","5. volume":"2641675"},"2018-12-27":{"1. open":"7.8700","2. high":"7.9545","3. low":"6.9700","4. close":"7.3000","5. volume":"3983477"},"2018-12-26":{"1. open":"7.2000","2. high":"8.0000","3. low":"7.1600","4. close":"8.0000","5. volume":"3782512"},"2018-12-24":{"1. open":"7.0500","2. high":"7.4400","3. low":"7.0100","4. close":"7.1600","5. volume":"1626177"},"2018-12-21":{"1. open":"7.8000","2. high":"7.8000","3. low":"7.0200","4. close":"7.2800","5. volume":"6443603"},"2018-12-20":{"1. open":"8.0400","2. high":"8.3000","3. low":"7.6000","4. close":"7.7600","5. volume":"2853474"},"2018-12-19":{"1. open":"8.4000","2. high":"8.7800","3. low":"8.0000","4. close":"8.0400","5. volume":"2546852"},"2018-12-18":{"1. open":"8.7700","2. high":"9.0500","3. low":"8.2900","4. close":"8.4100","5. volume":"2488465"},"2018-12-17":{"1. open":"8.8000","2. high":"9.2754","3. low":"8.6400","4. close":"8.7100","5. volume":"3049155"},"2018-12-14":{"1. open":"9.1200","2. high":"9.4100","3. low":"8.9100","4. close":"8.9900","5. volume":"2062037"},"2018-12-13":{"1. open":"10.0100","2. high":"10.0750","3. low":"9.3000","4. close":"9.3100","5. volume":"2356876"},"2018-12-12":{"1. open":"9.7400","2. high":"10.2600","3. low":"9.5800","4. close":"9.8100","5. volume":"2617108"},"2018-12-11":{"1. open":"9.6000","2. high":"9.7425","3. low":"9.3900","4. close":"9.4800","5. volume":"1502928"},"2018-12-10":{"1. open":"9.6200","2. high":"9.8000","3. low":"9.1800","4. close":"9.4600","5. volume":"2471805"},"2018-12-07":{"1. open":"10.1100","2. high":"10.2485","3. low":"9.5500","4. close":"9.6300","5. volume":"2291981"},"2018-12-06":{"1. open":"9.9800","2. high":"10.3290","3. low":"9.7600","4. close":"10.0600","5. volume":"2461311"},"2018-12-04":{"1. open":"11.0800","2. high":"11.3200","3. low":"10.2200","4. close":"10.2600","5. volume":"3052944"},"2018-12-03":{"1. open":"11.5200","2. high":"11.6600","3. low":"10.4600","4. close":"11.1900","5. volume":"2894092"},"2018-11-30":{"1. open":"10.9900","2. high":"11.3200","3. low":"10.6240","4. close":"11.2900","5. volume":"2280052"},"2018-11-29":{"1. open":"11.1200","2. high":"11.3500","3. low":"10.4600","4. close":"10.9900","5. volume":"2299454"},"2018-11-28":{"1. open":"10.5200","2. high":"11.4100","3. low":"10.2900","4. close":"11.4000","5. volume":"3362355"},"2018-11-27":{"1. open":"11.3500","2. high":"11.5300","3. low":"10.2200","4. close":"10.3500","5. volume":"4661108"},"2018-11-26":{"1. open":"12.2500","2. high":"12.3900","3. low":"11.1000","4. close":"11.4400","5. volume":"3407711"},"2018-11-23":{"1. open":"12.1000","2. high":"12.6200","3. low":"12.0400","4. close":"12.1700","5. volume":"1419329"},"2018-11-21":{"1. open":"11.8050","2. high":"12.3000","3. low":"11.5000","4. close":"12.2600","5. volume":"2679485"},"2018-11-20":{"1. open":"11.2900","2. high":"12.0790","3. low":"11.0500","4. close":"11.7100","5. volume":"3457897"},"2018-11-19":{"1. open":"12.3600","2. high":"12.4700","3. low":"11.5600","4. close":"11.6600","5. volume":"4891092"},"2018-11-16":{"1. open":"11.3000","2. high":"11.9411","3. low":"11.0000","4. close":"11.6400","5. volume":"2629835"},"2018-11-15":{"1. open":"10.9900","2. high":"11.4699","3. low":"10.7289","4. close":"11.4000","5. volume":"3118168"},"2018-11-14":{"1. open":"11.8100","2. high":"12.0900","3. low":"10.4700","4. close":"10.9700","5. volume":"7068691"},"2018-11-13":{"1. open":"13.3000","2. high":"13.7790","3. low":"11.2800","4. close":"11.5300","5. volume":"13064133"},"2018-11-12":{"1. open":"12.2900","2. high":"12.2900","3. low":"11.4900","4. close":"11.7300","5. volume":"3554465"},"2018-11-09":{"1. open":"12.8200","2. high":"13.4700","3. low":"11.5136","4. close":"12.3300","5. volume":"4033670"},"2018-11-08":{"1. open":"13.7500","2. high":"14.6000","3. low":"12.6300","4. close":"13.1400","5. volume":"4931733"},"2018-11-07":{"1. open":"13.8500","2. high":"14.4500","3. low":"13.5800","4. close":"14.0400","5. volume":"2966902"},"2018-11-06":{"1. open":"14.0600","2. high":"14.3100","3. low":"13.6600","4. close":"13.7400","5. volume":"1846422"},"2018-11-05":{"1. open":"14.4500","2. high":"14.7720","3. low":"13.6418","4. close":"14.0900","5. volume":"2010607"},"2018-11-02":{"1. open":"15.2300","2. high":"15.6900","3. low":"14.0700","4. close":"14.4000","5. volume":"3413533"},"2018-11-01":{"1. open":"13.6000","2. high":"15.4400","3. low":"13.5000","4. close":"15.3000","5. volume":"3325265"},"2018-10-31":{"1. open":"13.3900","2. high":"14.1000","3. low":"13.2100","4. close":"13.6000","5. volume":"2460423"},"2018-10-30":{"1. open":"13.1900","2. high":"13.6100","3. low":"12.7700","4. close":"13.1500","5. volume":"2313982"},"2018-10-29":{"1. open":"14.6200","2. high":"14.6900","3. low":"12.8700","4. close":"13.3400","5. volume":"3153599"},"2018-10-26":{"1. open":"13.0000","2. high":"14.5500","3. low":"12.8025","4. close":"14.2900","5. volume":"3926837"}}}}

 

Mein Code:

let Date := Datum;
let myURL := text(first(select Connection).URL) + text(Ticker) + "&apikey=" + text(first(select Connection).API_Key);
let response := http("GET", myURL);
if response.error then
alert("Error: " + text(response))
else
Antwort := text(response);
let OpenField := "1. open";
let HighField := "2. high";
let LowField := "3. low";
let CloseField := "4. close";
let VolField := "5. volume";
let TSField := "Time Series (Daily)";
let Symbol := Ticker;
Bezeichnung := "";
let Fehler := 0;
let Timer := 0;
while Fehler < 5 do
let Date := Datum - Timer;
let DatField := text(format(Date, "YYYY-MM-DD"));
let kvo := item(item(item(response.result, TSField), DatField), VolField);
let DSvorhanden := cnt(select Kurse where Datum = Date and Ticker = Symbol) > 0;
if DSvorhanden then
Fehler := 0;
void
else
if kvo != null then
let kop := item(item(item(response.result, TSField), DatField), OpenField);
let khi := item(item(item(response.result, TSField), DatField), HighField);
let klo := item(item(item(response.result, TSField), DatField), LowField);
let kco := item(item(item(response.result, TSField), DatField), CloseField);
Fehler := 0;
let ds := (create Kurse);
ds.(Ticker := Symbol);
ds.(Datum := Date);
ds.(Open := number(kop));
ds.(High := number(khi));
ds.(Low := number(klo));
ds.(Close := number(kco));
ds.(Volumen := number(kvo))
else
Fehler := Fehler + 1
end
end;
Timer := Timer + 1;
Bezeichnung := Timer + " - " + Fehler + " - " + Date
end

end

4 Antworten

null
    • Mirko
    • vor 5 Jahren
    • Gemeldet - anzeigen

    @support:

    also, es scheint daran zu liegen, dass ich dies auf dem iPad pro 12.9 ausführe. Im Web werden die 100 DS ohne Probleme komplett verarbeitet. Es scheint ein Arbeitsspeicher-Problem auf mobilen Geräten zu sein. Vielleicht könntet ihr das ja mal bei Gelegenheit prüfen und verbessern (effektives Nutzen/ Freigeben des Arbeitsspeichers). Ich könnte euch auch eine Besp.-DB zur Verfügung stellen, bei der ich das selbe Problem habe.

    • Leonid_Semik
    • vor 5 Jahren
    • Gemeldet - anzeigen

    Hallo,

    aus meiner Erfahrung mit REST und App kann ich nur raten die Abfrage über Server laufen zu lassen:

    —-

    let response:= do as server

    http("GET",myURL)

    end

    —-

    weitere Code kann ich schlecht beurteilen, aber hundert Datensätze sollte kein Problem darstellen. Ich hatte mit der App auch mehrere hundert bearbeiten können 

    Leo

    • Mirko
    • vor 5 Jahren
    • Gemeldet - anzeigen

    Hallo,

    danke für die Info, das ist aber nicht das Problem. Die Daten werden mit http("GET"...) ja geholt aber das Problem ist die nachträgliche Bearbeitung, d.h., das zerlegen des Formats in die Einzelteile. Dies funktioniert mit den ersten 50 DS einwandfrei (wenn ich das auf 50 begrenze) aber halt nicht mit den kompletten 100 DS im result. Es sieht so aus, dass mit jedem Schleifendurchlauch der allokierte Arbeitsspeicher auf dem iPad ansteigt, bis halt „nichts mehr geht". Die Konsequenz ist, Ninox „hart" zu beenden. Wenn ich dann in die Kurstabelle schaue sind halt nur die DS angelegt, die funktioniert haben. Wenn ich die Datenbank im Web ausführe werden alle Daten bearbeitet und korrekt angelegt, nur halt nicht auf dem iPad.

    Gruß

    Mirko

    • Mirko
    • vor 5 Jahren
    • Gemeldet - anzeigen

    Danke Leo,

    habe die while-Schleife in das do as server eingebettet und... funktioniert nun auch super auf dem iPad mit den gesamten Daten.

    Danke für deinen Tipp.

    do as server

         while Fehler < 5 do 

             ..."der ganze Code"...

         end

    end

Content aside

  • vor 5 JahrenZuletzt aktiv
  • 4Antworten
  • 2496Ansichten