Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Calculating 5 minute frequency stock price using last tick interpolation

    Dears,

    I have a dataset, includes variables serial, year, month, day, second, and price. I want to calculate the 5 minute frequency, using last tick interpolation and construct 5 minutes log-returns. Below is a sample of the data. Could you aid me to get the code?

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input byte serial int year byte(month day) int second float price
    1 2005 1 3   2   121.56
    1 2005 1 3   4   121.56
    1 2005 1 3  34   121.56
    1 2005 1 3  35  121.535
    1 2005 1 3  80   121.51
    1 2005 1 3  83   121.52
    1 2005 1 3  91   121.52
    1 2005 1 3  96   121.54
    1 2005 1 3 112   121.55
    1 2005 1 3 114   121.55
    1 2005 1 3 147   121.56
    1 2005 1 3 162   121.55
    1 2005 1 3 172   121.54
    1 2005 1 3 180   121.55
    1 2005 1 3 182   121.56
    1 2005 1 3 185   121.55
    1 2005 1 3 209   121.59
    1 2005 1 3 223   121.59
    1 2005 1 3 224   121.59
    1 2005 1 3 250   121.61
    1 2005 1 3 251   121.62
    1 2005 1 3 254   121.63
    1 2005 1 3 262   121.64
    1 2005 1 3 263   121.64
    1 2005 1 3 264   121.64
    1 2005 1 3 266   121.65
    1 2005 1 3 282   121.62
    1 2005 1 3 283   121.62
    1 2005 1 3 285    121.6
    1 2005 1 3 290   121.62
    1 2005 1 3 296   121.62
    1 2005 1 3 297   121.64
    1 2005 1 3 304   121.63
    1 2005 1 3 314   121.62
    1 2005 1 3 331   121.66
    1 2005 1 3 332   121.66
    1 2005 1 3 333   121.66
    1 2005 1 3 334   121.67
    1 2005 1 3 335   121.65
    1 2005 1 3 336   121.65
    1 2005 1 3 337   121.68
    1 2005 1 3 363   121.67
    1 2005 1 3 365 121.6702
    1 2005 1 3 366   121.65
    1 2005 1 3 404   121.65
    1 2005 1 3 410   121.67
    1 2005 1 3 411    121.7
    1 2005 1 3 412    121.7
    1 2005 1 3 413   121.71
    1 2005 1 3 415   121.71
    1 2005 1 3 416   121.71
    1 2005 1 3 418   121.71
    1 2005 1 3 419   121.71
    1 2005 1 3 421   121.71
    1 2005 1 3 426   121.72
    1 2005 1 3 446   121.71
    1 2005 1 3 457   121.71
    1 2005 1 3 471   121.71
    1 2005 1 3 473   121.71
    1 2005 1 3 476   121.71
    1 2005 1 3 484   121.72
    1 2005 1 3 499   121.72
    1 2005 1 3 521   121.72
    1 2005 1 3 531   121.71
    1 2005 1 3 532   121.71
    1 2005 1 3 534    121.7
    1 2005 1 3 573   121.72
    1 2005 1 3 574   121.72
    1 2005 1 3 588   121.71
    1 2005 1 3 597   121.69
    1 2005 1 3 682   121.65
    1 2005 1 3 694   121.65
    1 2005 1 3 710   121.67
    1 2005 1 3 712   121.67
    1 2005 1 3 713   121.67
    1 2005 1 3 739   121.69
    1 2005 1 3 744   121.69
    1 2005 1 3 745   121.67
    1 2005 1 3 746   121.66
    1 2005 1 3 777   121.71
    1 2005 1 3 781   121.66
    1 2005 1 3 801   121.65
    1 2005 1 3 811   121.65
    1 2005 1 3 812  121.655
    1 2005 1 3 815   121.64
    1 2005 1 3 816   121.68
    1 2005 1 3 825   121.65
    1 2005 1 3 842   121.62
    1 2005 1 3 844   121.62
    1 2005 1 3 849   121.64
    1 2005 1 3 851   121.66
    1 2005 1 3 857   121.66
    1 2005 1 3 858   121.67
    1 2005 1 3 864   121.66
    1 2005 1 3 868   121.64
    1 2005 1 3 896   121.65
    1 2005 1 3 923   121.66
    1 2005 1 3 961   121.66
    1 2005 1 3 964   121.66
    1 2005 1 3 994   121.66
    end
    Last edited by Emad Noureldeen; 28 Oct 2023, 15:39.
Working...
X