Thema Datum  Von Nutzer Rating
Antwort
06.05.2016 22:31:26 David
NotSolved
09.05.2016 09:50:09 Gast26310
NotSolved
09.05.2016 10:53:06 David
NotSolved
09.05.2016 14:59:44 Gast47416
NotSolved
09.05.2016 15:27:39 David
NotSolved
09.05.2016 20:03:50 Gast79172
NotSolved
09.05.2016 21:45:15 David
NotSolved
10.05.2016 07:48:17 Gast22592
NotSolved
10.05.2016 22:12:36 David
NotSolved
11.05.2016 10:49:01 Gast91729
NotSolved
16.05.2016 14:04:12 David
NotSolved
17.05.2016 07:35:07 SJ
NotSolved
17.05.2016 10:02:37 David
NotSolved
17.05.2016 11:00:44 SJ
NotSolved
17.05.2016 21:28:18 David
NotSolved
18.05.2016 07:56:42 SJ
NotSolved
Rot Rot Kurszeitreihenanalyse von Bitcoins
18.05.2016 19:59:04 Gast63961
NotSolved

Ansicht des Beitrags:
Von:
Gast63961
Datum:
18.05.2016 19:59:04
Views:
816
Rating: Antwort:
  Ja
Thema:
Kurszeitreihenanalyse von Bitcoins

Hallo SJ,

 

hmm also ich habe es wie folgt gelöst, könntest du kuz einmal drüber gucken?

 

  • Nachdem die Daten geladen werden, habe ich ein Makro eingefügt, welches die Datumwerte absteigend sortiert.
  • Den Durchschnitt habe ich anders hinbekommen. Hier muss ich im Tabellenblatt 2, die Funktion eingeben und im Tabellenblatt 1 den Bereich E markieren, da ja alles neu geladen wird, wenn ich die Daten neu importiere.
  • Aber es wird folgendes verlangt, was die Sache umständlicher macht:     Zusätzlich soll nachdem die Daten geladen wurden über VBA in einer zusätzlichen Spalte ein gleitender Durchschnitt errechnet werden (basierend auf der Konfiguration).   Die Konfiguration schaut wie folgt aus: http://www.fotos-hochladen.net/uploads/konfigo3ahj8gfks.png
  • Beim RSI (Relative Strength Index)  genau so, hier habe ich auch bereits die Formel, weiß aber leider nicht, wie es mit der Konfiguration geht. 

 

----> https://fhbfiwien-my.sharepoint.com/personal/fhb150650_fh-vie_ac_at/_layouts/15/guestaccess.aspx?guestaccesstoken=WxojyalbbR2WAz%2fpsViHbA0d%2bZbFxXOTEKdbpFIm8VY%3d&docid=0a000ca75c39f47e18ff814258dd6f360

 


Option Explicit

Private Declare Function URLDownloadToFile Lib "urlmon" _
  Alias "URLDownloadToFileA" ( _
  ByVal pCaller As Long, _
  ByVal szURL As String, _
  ByVal szFileName As String, _
  ByVal dwReserved As Long, _
  ByVal lpfnCB As Long) As Long
    
Public Sub download_und_import_bitcoin_courses()
    If download_file <> 0 Then
        MsgBox "Problem beim herunterladen.", vbExclamation
        Exit Sub
    End If
      
    Call import
    Call sortierung
     
    MsgBox "Import erfolgreich.", vbInformation
End Sub
  
Private Function download_file() As Long
    Dim strURL As String
    Dim strLocalFile As String
      
    'Link zum Donwload
    strURL = "http://www.quandl.com/api/v3/datasets/BITFINEX/BTCUSD.csv"
      
    'Pfad für den Speicherort
    strLocalFile = ThisWorkbook.Path & "\Bitcoin_" & Format(Date, "YYYYMMDD") & ".csv"
      
    'Datei herunterladen und Status zurückgeben
    download_file = URLDownloadToFile(0, strURL, strLocalFile, 0, 0)
End Function


Sub sortierung()
'
' sortierung Makro
'

'
    Range("A1:H750").Select
    ActiveWorkbook.Worksheets("Tabelle1").Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("Tabelle1").Sort.SortFields.Add Key:=Range( _
        "A2:A750"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
        xlSortNormal
    With ActiveWorkbook.Worksheets("Tabelle1").Sort
        .SetRange Range("A1:H750")
        .Header = xlYes
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
End Sub



Private Sub import()
    Dim fso As Object
    Dim txtStream As Object
    Dim i As Integer, j As Integer
    Dim strPfad As String
    Dim strDaten() As String
    Dim wksImport As Worksheet
    'Tabelle, in der importiert wird
    Set wksImport = Worksheets("Tabelle1")
    'Bereich in dem Eingefügt wird (1,1 = A1; 2,1 = A2..)
    i = 1: j = 1
    'Tabellenblatt leeren
    wksImport.Cells.Clear
      
    strPfad = ThisWorkbook.Path & "\Bitcoin_" & Format(Date, "YYYYMMDD") & ".csv"
    Set fso = CreateObject("Scripting.FilesystemObject")
    Set txtStream = fso.OpenTextfile(strPfad)
      
    Do While Not txtStream.AtEndOfStream
        strDaten() = Split(txtStream.ReadLine, ",")
        For j = 0 To UBound(strDaten())
            wksImport.Cells(i, j + 1) = strDaten(j)
        Next j
        i = i + 1
    Loop
      
    txtStream.Close
    Set txtStream = Nothing
    Set fso = Nothing
End Sub

Function durchschnitt(arr As Range) As Double
    Dim v As Variant
    Dim sum As Double
     
     
    For Each v In arr
        sum = sum + v
    Next
     
    durchschnitt = sum / arr.Count
     
End Function

Function RSI(arr As Range)
    Dim up_day, down_day, ups, downs
    Dim average_up, average_down
    Dim RS, cellcount As Long
    Dim cll As Range
        ups = 0
        up_day = 0
        downs = 0
        down_day = 0
        cellcount = 0
            For Each cll In arr
                cellcount = cellcount + 1
                
            If cellcount = arr.Count Then Exit For
            If cll.Value >= cll.Offset(1, 0).Value Then
            downs = downs + cll - cll.Offset(1, 0).Value
            ElseIf cll.Value < cll.Offset(1, 0).Value Then
            ups = ups + cll.Offset(1, 0).Value - cll.Value
        
            End If
            
Next cll
        average_up = ups / cellcount
        average_down = downs / cellcount
        
        RS = average_up / average_down
        
        RSI = 100 - (100 / (1 + RS))
        
End Function

 

 


Ihre Antwort
  • Bitte beschreiben Sie Ihr Problem möglichst ausführlich. (Wichtige Info z.B.: Office Version, Betriebssystem, Wo genau kommen Sie nicht weiter)
  • Bitte helfen Sie ebenfalls wenn Ihnen geholfen werden konnte und markieren Sie Ihre Anfrage als erledigt (Klick auf Häckchen)
  • Bei Crossposting, entsprechende Links auf andere Forenbeiträge beifügen / nachtragen
  • Codeschnipsel am besten über den Code-Button im Text-Editor einfügen
  • Die Angabe der Emailadresse ist freiwillig und wird nur verwendet, um Sie bei Antworten auf Ihren Beitrag zu benachrichtigen
Thema: Name: Email:



  • Bitte beschreiben Sie Ihr Problem möglichst ausführlich. (Wichtige Info z.B.: Office Version, Betriebssystem, Wo genau kommen Sie nicht weiter)
  • Bitte helfen Sie ebenfalls wenn Ihnen geholfen werden konnte und markieren Sie Ihre Anfrage als erledigt (Klick auf Häckchen)
  • Bei Crossposting, entsprechende Links auf andere Forenbeiträge beifügen / nachtragen
  • Codeschnipsel am besten über den Code-Button im Text-Editor einfügen
  • Die Angabe der Emailadresse ist freiwillig und wird nur verwendet, um Sie bei Antworten auf Ihren Beitrag zu benachrichtigen

Thema Datum  Von Nutzer Rating
Antwort
06.05.2016 22:31:26 David
NotSolved
09.05.2016 09:50:09 Gast26310
NotSolved
09.05.2016 10:53:06 David
NotSolved
09.05.2016 14:59:44 Gast47416
NotSolved
09.05.2016 15:27:39 David
NotSolved
09.05.2016 20:03:50 Gast79172
NotSolved
09.05.2016 21:45:15 David
NotSolved
10.05.2016 07:48:17 Gast22592
NotSolved
10.05.2016 22:12:36 David
NotSolved
11.05.2016 10:49:01 Gast91729
NotSolved
16.05.2016 14:04:12 David
NotSolved
17.05.2016 07:35:07 SJ
NotSolved
17.05.2016 10:02:37 David
NotSolved
17.05.2016 11:00:44 SJ
NotSolved
17.05.2016 21:28:18 David
NotSolved
18.05.2016 07:56:42 SJ
NotSolved
Rot Rot Kurszeitreihenanalyse von Bitcoins
18.05.2016 19:59:04 Gast63961
NotSolved