This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""convert Fortran code to lower case except for comments | |
usage: python xlower_case_fortran.py <source_file> | |
The script writes lower case code to standard output. | |
""" | |
from sys import argv | |
source_file = argv[1] | |
fp = open(source_file,"r") | |
for line in fp: | |
text = line.rstrip() | |
ipos = text.find("!") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
! RESULTS: | |
! #paths initial ann_drift ann_vol min max <terminal> terminal terminal-max sd(terminal) %bottom | |
! 100000 100.00 0.15 0.40 77.99 145.60 116.18 115.95 -29.65 48.21 4.52 | |
! 100000 100.00 0.15 0.40 77.97 145.67 116.18 116.04 -29.63 48.30 4.39 | |
! 100000 100.00 0.15 0.40 77.92 145.58 116.18 115.88 -29.70 48.25 4.33 | |
! 100000 100.00 0.15 0.40 78.02 145.96 116.18 116.27 -29.69 48.64 4.41 | |
! 100000 100.00 0.15 0.40 78.02 145.53 116.18 115.93 -29.60 47.89 4.37 | |
module statistics_mod | |
implicit none | |
public :: dp,mean,sd,random_normal |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 01/16/2020 11:14 PM gets historical quotes for specified symbols at various frequencies | |
.proctime00 = proc.time() | |
library(IBrokers) | |
tws <- twsConnect() | |
print.contract.details = TRUE | |
get.mkt.data <- FALSE | |
get.hist.data <- FALSE | |
get.intraday.data <- TRUE | |
tws <- twsConnect() | |
symbols <- c("SPY","TLT") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# adapted from https://www.quantinsti.com/blog/an-example-of-a-trading-strategy-coded-in-r | |
# issue the commands install.packages("quantmod") and install.packages("PerformanceAnalytics") | |
# before running this script | |
library("quantmod") | |
library("PerformanceAnalytics") | |
plot.macd = TRUE | |
ndrawdowns = 3 | |
short.pos = 0 # size of short position. Set to 0 to disallow shorting | |
sym = "PCI" # symbol to be tested -- can be changed | |
all.data = getSymbols(sym,auto.assign=FALSE) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 2018-06-23 | |
# list unused variable from gfortran output | |
# valid Python 2 and Python 3 | |
from sys import argv | |
compiler_message_file = argv[1] # produced by command such as gfortran 2> err_msg.txt -c -Werror=unused_variable source.f90 | |
fp = open(compiler_message_file,"r") | |
err_str = "Error: Unused variable" | |
print("unused variables:") | |
for line in fp: | |
text = line.strip() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
program test | |
! 05/23/2018 11:49 AM times varies loop methods with global or block variables -- motivated by comp.lang.fortran thread "ASSOCIATE inside loops" https://groups.google.com/forum/#!topic/comp.lang.fortran/TBYnHxFIrS0 | |
use, intrinsic :: iso_fortran_env | |
integer(int64), parameter :: n = 2**25 | |
integer(int64) :: i, t0, t1, count_rate | |
integer, parameter :: nways = 6 | |
real, dimension(n) :: x, y, ysum(nways), dt(nways) | |
character(*), parameter :: fmt1 = "(a14,1x,f8.4)" | |
logical, parameter :: print_sums = .false., print_each = .false. | |
character (len=10) :: methods(nways) = ["global ", & |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global associate block no_temp forall do_concurrent | |
gfortran 0.4640 0.3598 0.3601 0.3446 0.2281 0.2222 | |
gfortran -O3 0.1914 0.1079 0.1097 0.1072 0.1093 0.1080 | |
ifort 0.1475 0.0728 0.0737 0.0749 0.0718 0.0718 | |
ifort -O3 0.1488 0.0714 0.0718 0.0722 0.0718 0.0724 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- 05/01/2018 10:31 AM display quotes for all CEFs --> | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta charset="utf-8"> | |
<title>Closed-End Funds</title> | |
<link rel="icon" href="https://d3v3cbxkdlyonc.cloudfront.net/stocks/favicon.ico"> | |
<meta name="description" content="A free, lightweight, blazing-fast page to get stock quotes using the IEX API"> |