Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/beaniejoy/do-it-quant

πŸ“ˆ ν€€νŠΈ νˆ¬μžμ— κΈ°λ°˜ν•œ μ’…λͺ© ranking μ„œλΉ„μŠ€ (react-native, spring boot, python)
https://github.com/beaniejoy/do-it-quant

Last synced: 1 day ago
JSON representation

πŸ“ˆ ν€€νŠΈ νˆ¬μžμ— κΈ°λ°˜ν•œ μ’…λͺ© ranking μ„œλΉ„μŠ€ (react-native, spring boot, python)

Awesome Lists containing this project

README

        

# πŸ“ˆ Do It Quant

[![Build Status](https://travis-ci.org/hanbinleejoy/do-it-quant.svg?branch=master)](https://travis-ci.org/hanbinleejoy/do-it-quant)


## πŸ’‘ Introduction

- 주식 투자λ₯Ό λ„μ™€μ£ΌλŠ” Quant 기반 μ’…λͺ© μΆ”μ²œ λͺ¨λ°”일 μ•±μž…λ‹ˆλ‹€.
- 7개 μ€‘μš” νˆ¬μžμ§€ν‘œλ₯Ό ν† λŒ€λ‘œ μ‚¬μš©μžκ°€ λΉ„μ€‘μΉ˜λ₯Ό 직접 μž…λ ₯ν•˜λ©΄ 이 λΉ„μ€‘μΉ˜λ“€μ„ κΈ°μ€€μœΌλ‘œ κ³„μ‚°ν•˜μ—¬
1 ~ 10μœ„ κΉŒμ§€μ˜ μ’…λͺ©μ„ μ œμ‹œν•΄μ£ΌλŠ” μ•±μž…λ‹ˆλ‹€.
- 이λ₯Ό 톡해 주관적인 νŒλ‹¨μ— μ˜ν•œ νˆ¬μžκ°€ μ•„λ‹Œ κΈ°κ³„μ μœΌλ‘œ νˆ¬μžν•  수 있게 λ„μ™€μ£ΌλŠ” μ„œλΉ„μŠ€λ₯Ό μ œκ³΅ν•©λ‹ˆλ‹€.
- 적립식 주식 투자, λ‹€μ–‘ν•œ 투자 포트폴리였 ꡬ성 λ“± μ—¬λŸ¬ 뢀문에 ν™œμš©ν•  수 μžˆμ„ κ²ƒμœΌλ‘œ κΈ°λŒ€ν•©λ‹ˆλ‹€.


## 🀝 Team

- Front, Mobile: [`feelcard`](https://github.com/feelcard)
- Back, Cloud: `hanbinleejoy`
- Data Crawling: [`SeoYeonii`](https://github.com/SeoYeonii)


## πŸ”– Stack

- Front(Mobile): React-Native, Android
- Back: Spring Boot `2.2.6` (Java 8)
- Test: JUnit4
- Build: Gradle `5.6.4`
- DB: MariaDB(AWS RDS)
- Cloud: AWS EC2
- Crawling: python


## πŸ”– μ„œλΉ„μŠ€ ꡬ쑰


## πŸ”– λžœλ”λ§ ν™”λ©΄





## πŸ”– API μš”κ΅¬μ‚¬ν•­(DB Table ꡬ성)

- **company_data** (λΆ„κΈ°λ§ˆλ‹€ μžλ™ update)
- `per`
- `pbr`
- `roa`
- `roe`
- `debt_ratio`(λΆ€μ±„λΉ„μœ¨)
- `operating_profit_ratio`(μ˜μ—…μ΄μ΅λ₯ )
- `reserve_ratio`(유보율)

- **company_detail** (λΆ„κΈ°λ§ˆλ‹€ μžλ™ update)
- `code`(μ’…λͺ©μ½”λ“œ)
- `cmp_name`(μ’…λͺ©λͺ…/기업이름)
- `total_asset`(μ΄μžμ‚°)
- `total_equity`(총자본)
- `total_debt`(총뢀채)
- `sales`(λ§€μΆœμ•‘)
- `operating_profit`(μ˜μ—…μ΄μ΅)
- `net_income`(당기손이읡)
- `retained_earnings`(이읡 μž‰μ—¬κΈˆ)
- `description`(기업상세섀λͺ…)
- `market`(μ—…μ’…)

- **daily_price** (맀일 μž₯마감 κΈ°μ€€μœΌλ‘œ μžλ™ update)
- `code`(μ’…λͺ©μ½”λ“œ)
- `end_price`(μ’…κ°€)


## πŸ”– μ‹œμŠ€ν…œ μž‘λ™ μ„€λͺ…


### Scheduling μ„€μ •

> 1. `daily_price`: 맀일 16:00에 DB μ—…λ°μ΄νŠΈ
> 2. `quant_data`, `company_detail`: λΆ„κΈ°λ§ˆλ‹€ DB μ—…λ°μ΄νŠΈ(2, 5, 8, 11μ›” κΈ°μ€€ 15일둜 μ„€μ •)


#### AWS Linux μ„œλ²„ λ‚΄ Scheduling μ„€μ •

```cmd
$crontab -e

0 0 15 2,5,8,11 * python3 /home/ec2-user/app/diq/web_crawling_general.py
0 16 * * 1-5 python3 /home/ec2-user/app/diq/web_crawling_Jongga.py
```
1. `daily_price`: 맀일 16μ‹œ 0뢄에 λͺ…λ Ή μžλ™ μ‹€ν–‰,
- `dailyUpdateData.json` 파일 λ°˜ν™˜
2. `quant_data`, `company_detail`: 2, 5, 8, 11μ›” 15일 0μ‹œ 0뢄에 λͺ…λ Ή μžλ™ μ‹€ν–‰
- `QuantDataTable.json`, `CompanyDetailTable.json` 파일 λ°˜ν™˜


#### Spring Boot μ„€μ •

```java
@SpringBootApplication
@EnableScheduling
public class QuantApplication {

public static void main(String[] args) {
SpringApplication.run(QuantApplication.class, args);
}
}
```
- `@EnableScheduling` 섀정을 톡해 Spring Boot에 Scheduler 등둝

```java
// QuantDataController.java, CompanyDetailController.java
@Scheduled(cron = "0 30 0 * 2,5,7,11 *", zone = "Asia/Seoul")
public ResponseEntity bulkUpdate()
throws JsonParseException, JsonMappingException, IOException {
//ν•΄λ‹Ή Logic...
}

// DailyPriceController.java
@Scheduled(cron = "0 30 16 * * 1-5", zone = "Asia/Seoul")
public ResponseEntity bulkUpdate()
throws JsonParseException, JsonMappingException, IOException {
//ν•΄λ‹Ή Logic...
}
```
1. python μ½”λ“œ 싀행이 μ™„λ£Œλ˜λŠ”λ° 20 ~ 30뢄정도 μ†Œμš”λ˜λ―€λ‘œ Spring Bootμ—μ„œλŠ” Linuxμ„œλ²„ 섀정보닀 30λΆ„ 늦게 Scheduling μ„€μ •
2. python μ½”λ“œλ‘œ crawling된 데이터듀을 담은 json νŒŒμΌμ„ WASμ—μ„œ λ°›μ•„μ„œ μ²˜λ¦¬ν•œλ‹€.
- `dailyUpdateData.json` > `DailyPriceController.java`
- `QuantDataTable.json` > `QuantDataController.java`
- `CompanyDetailTable.json` > `CompanyDetailController.java`


### React-Native λ‚΄ Async Storage μ‚¬μš©

μ‚¬μš©μžκ°€ Modify νŽ˜μ΄μ§€λ₯Ό 톡해 7개 μ§€ν‘œμ— λŒ€ν•œ λΉ„μ€‘μΉ˜λ₯Ό μˆ˜μ •ν•  λ•Œλ§ˆλ‹€ ν΄λΌμš°λ“œ μ„œλ²„ DB에 μš”μ²­ν•œλ‹€λ©΄ λΉ„νš¨μœ¨μ μ΄λΌκ³  μƒκ°ν–ˆμŠ΅λ‹ˆλ‹€.
이에 앱을 처음 μ‹œμž‘ν–ˆμ„ λ•Œ React-Nativeμ—μ„œ μ§€μ›ν•˜λŠ” Async Storage에 μ„œλ²„ DB 데이터듀을 ν•œ 번 λ™κΈ°ν™”ν•œλ‹€λ©΄ μ„œλ²„μ˜ 뢀담을 쀄일 수 μžˆμ„ 것이라 νŒλ‹¨ν•˜κ³  κ°œλ°œμ„ μ§„ν–‰ν–ˆμŠ΅λ‹ˆλ‹€.