This file contains 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
this.polyLine = new H.map.Polyline( | |
this.lineString, {style: {lineWidth: 4, strokeColor: "#62A8EA", lineDash: [4]}} | |
) |
This file contains 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
from dateutil.relativedelta import relativedelta | |
# def date_iter_periodicity(start_date, end_date, hold_days): | |
# date = start_date | |
# while date < end_date: | |
# yield (date), (date + datetime.timedelta(hold_days)) | |
# date += datetime.timedelta(hold_days) | |
def date_iter_periodicity(start_date, end_date, interval): | |
date = start_date | |
while date < end_date: |
This file contains 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
def 獲利年數(data): | |
eps = data.get('稀釋每股盈餘合計', 4*10).fillna(0) | |
count = 0 | |
for start, end in zip(range(0, 37, 4), range(4, 41, 4)): | |
if not (eps.iloc[start:end].empty): | |
count += eps.iloc[start:end].sum() > 0 | |
return count |
This file contains 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
import configparser | |
import json | |
import logging | |
import time | |
from hashlib import md5 | |
import requests | |
config = configparser.ConfigParser() | |
config.read('config.ini') |
This file contains 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
web: node src/index.js --log-file - |
This file contains 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
const {LineHandler} = require('bottender') | |
const olami = require('./nlp/Olami') | |
const helpMessage = 'Hi~ 本 Bot 是用 http://bit.ly/2uz7wY4 開源程式碼打造\n\n' + | |
'您可以問我\n' + | |
'天氣:「台北天氣如何」\n' + | |
'百科:「川普是誰」\n' + | |
'新聞:「今日新聞」\n' + | |
'音樂:「我想聽周杰倫的等你下課」;「播放告白氣球」;「播放動漫歌曲類型的歌」\n' + | |
'日曆:「現在時間」\n' + |
This file contains 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
const {LineHandler} = require('bottender') | |
const olami = require('./nlp/Olami') | |
exports.lineHandler = new LineHandler() | |
.onText(async context => { | |
const text = context.event.text | |
const userId = context._session.user.id | |
const reply = await olami.nli(text, userId) | |
await context.reply([reply.toLineMessage()]) | |
} |
This file contains 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
module.exports = class Message { | |
constructor(data) { | |
this.data = data | |
} | |
toLineMessage() { | |
return this.data | |
} | |
toMessengerMessage() { |
This file contains 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
const config = require('../../config') | |
const axios = require('axios') | |
const md5 = require('md5') | |
const KKBOX = require('../api/KKBOX') | |
class Olami { | |
constructor(appKey = config.olami.appKey, appSecret = config.olami.appSectet, inputType = 1) { | |
this.URL = 'https://tw.olami.ai/cloudservice/api' | |
this.appKey = appKey | |
this.appSecret = appSecret |
This file contains 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
const config = require('../../config') | |
const axios = require('axios') | |
const md5 = require('md5') | |
class Olami { | |
constructor(appKey = config.olami.appKey, appSecret = config.olami.appSectet, inputType = 1) { | |
this.URL = 'https://tw.olami.ai/cloudservice/api' | |
this.appKey = appKey | |
this.appSecret = appSecret | |
this.inputType = inputType |
NewerOlder