Code Monkey home page Code Monkey logo

myinvestmentmodules's Introduction

My Investment Modules

Someday these will be an integrated trading system, but not now. So I am sad.

<VBA>

Main Version Component Date Latest Link
v0.311 Current Price - T1101 2.1 2022.06.16 Link
Login 2.01
Read Account List 1.01
v0.31 Current Price - T1101 2.0 2021.11.23 Link
v0.301 Current Price - T1101 1.1 2021.11.22 Link
v0.3 Current Price - T1101 1.0 2021.11.17 Link
v0.2 Read Account List 1.0 2021.11.10 Link
v0.11 Login 2.0 2021.11.09 Link
v0.1 Login 1.0 2021.11.08 Link

Written by ChatGPT (not 100% accuracy guaranteed)

myinvestmentmodules's People

Contributors

kimpro82 avatar

Watchers

 avatar

Forkers

minari2

myinvestmentmodules's Issues

LS Open API / Python : KOSPI호가잔량(`H1_`), KOSDAQ호가잔량(`HA_`)

  • Reference

  • Sample code

    • KOSPI호가잔량(H1_)
      from urllib2 import Request, urlopen
      from urllib import urlencode, quote_plus
      url = '/websocket/stock'
      values  = ''
      headers = {  }
      request = Request(url
      , data=values
      , headers=headers)
      request.get_method = lambda: 'POST'
      response_body = urlopen(request).read()
      print response_body
    • KOSDAQ호가잔량(HA_)
      from urllib2 import Request, urlopen
      from urllib import urlencode, quote_plus
      url = '/websocket/stock'
      values  = ''
      headers = {  }
      request = Request(url
      , data=values
      , headers=headers)
      request.get_method = lambda: 'POST'
      response_body = urlopen(request).read()
      print response_body

Multi-Charts

An old request from my dear friend. I haven't forgotten ……

R : Download Stock Price Data with `tidyquant`

by ChatGPT

tidyquant 패키지를 사용하여 KODEX 레버리지 및 KODEX 200선물인버스2X의 일정 기간 동안의 주가, 거래량, 기관/외국인/개인 순매수 등을 다운로드하여 CSV 파일로 저장하는 예시 코드입니다:

# 필요한 라이브러리를 로드합니다
library(tidyquant)

# 다운로드 받을 종목의 심볼을 정의합니다
symbols <- c("122630.KS", "252670.KS")  # KODEX 레버리지, KODEX 200선물인버스2X

# 데이터를 다운로드할 기간을 설정합니다
start_date <- "2022-01-01"
end_date <- "2022-12-31"

# 종목 데이터를 다운로드합니다
data <- tq_get(symbols, from = start_date, to = end_date)

# 데이터프레임을 CSV 파일로 저장합니다
write.csv(data, file = "stock_data.csv")

위의 코드를 실행하면 tidyquant 패키지를 사용하여 KODEX 레버리지와 KODEX 200선물인버스2X의 주가 데이터를 다운로드하고, stock_data.csv라는 파일로 저장합니다. 다운로드 받을 기간을 start_dateend_date 변수로 설정하고, symbols 변수에 종목 심볼을 입력하여 필요한 종목을 선택할 수 있습니다. 데이터를 다운로드한 후에는 write.csv 함수를 사용하여 데이터를 CSV 파일로 저장합니다. tidyquant 패키지는 quantmod보다 데이터 다운로드 및 가공을 간편하게 수행할 수 있는 기능을 제공합니다.

R : Simulation to Compare Arithmetic Mean and Geometrical Mean

Here is some R code that demonstrates how to compare the arithmetic mean and geometric mean using Monte Carlo simulation:

# Set the number of simulations
n_simulations <- 10000

# Set the sample size
sample_size <- 10

# Set the range of values for the random sample
sample_range <- c(1, 10)

# Initialize vectors to store the results of the simulations
arithmetic_mean <- numeric(n_simulations)
geometric_mean <- numeric(n_simulations)

# Run the simulations
for (i in 1:n_simulations) {
  # Generate a random sample
  sample <- runif(sample_size, min = sample_range[1], max = sample_range[2])
  
  # Calculate the arithmetic mean of the sample
  arithmetic_mean[i] <- mean(sample)
  
  # Calculate the geometric mean of the sample
  geometric_mean[i] <- exp(mean(log(sample)))
}

# Calculate the mean and standard deviation of the arithmetic means
arithmetic_mean_mean <- mean(arithmetic_mean)
arithmetic_mean_sd <- sd(arithmetic_mean)

# Calculate the mean and standard deviation of the geometric means
geometric_mean_mean <- mean(geometric_mean)
geometric_mean_sd <- sd(geometric_mean)

# Print the results
print(paste("Arithmetic mean:", arithmetic_mean_mean, "±", arithmetic_mean_sd))
print(paste("Geometric mean:", geometric_mean_mean, "±", geometric_mean_sd))

This code will generate n_simulations random samples of size sample_size from a uniform distribution with a range of sample_range, and calculate the arithmetic and geometric means of each sample. It will then calculate the mean and standard deviation of the arithmetic means and the mean and standard deviation of the geometric means, and print the results.

I hope this helps! Let me know if you have any questions.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.