Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
anyongjin committed Dec 10, 2024
0 parents commit f8bee16
Show file tree
Hide file tree
Showing 87 changed files with 13,721 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
//..
settings: {
//...
'svelte3/ignore-warnings': (warning) => {
return warning.code === 'a11y-click-events-have-key-events'
},
},
}
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
yarn-error.log
.svelte-kit
.vscode


node_modules

# Output
.output
.vercel
/.svelte-kit
/build
/dist

# OS
.DS_Store
Thumbs.db

# Env
.env
.env.*
!.env.example
!.env.test

# Vite
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
engine-strict=true
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Package Managers
package-lock.json
pnpm-lock.yaml
yarn.lock
17 changes: 17 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"useTabs": true,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100,
"plugins": [
"prettier-plugin-svelte"
],
"overrides": [
{
"files": "*.svelte",
"options": {
"parser": "svelte"
}
}
]
}
81 changes: 81 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# KlineCharts-demo-svelte
这是一个示例项目,使用KlineCharts(10.0.0-alpha1)绘制金融K线图,界面UI从[KLineChart Pro](https://pro.klinecharts.com/getting-started.html)改写(KLineChart Pro使用Solid-js,本项目改写为svelte)
本项目使用[sveltekit](https://svelte.dev/)
如需vue版本,请参考[klinechart-ui-demo](https://github.com/anyongjin/klinechart-ui-demo)(此版本基于KlineChart 9.8.10)

# 如何使用
由于交易界面UI要求的定制性一般比较高,将此项目打包为package不太适合自由修改。
所以建议直接clone本项目,提取需要的部分,自由修改页面组件和UI

## 开始预览
```bash
yarn install
yarn dev
```

## 开发笔记
** 国际化 **
使用inlang的国际化[插件](https://inlang.com/m/dxnzrydw/paraglide-sveltekit-i18n/getting-started)
1. 在 project.inlang/settings.json 中添加语言标签,并在 messages 文件夹下添加语言文件。
5. 在需要使用语言标签的地方,使用:
```typescript
import * as m from '$lib/paraglide/messages.js'
m.hello()
m['hello']()
```

** 注册新指标 **
在 src/lib/coms.ts 中添加新指标的字段和默认参数。

** 编译为静态资源 **
sveltekit支持编译静态资源,只需将svelte.config.js中的`adapter-auto`改为`adapter-static`,然后执行`npm run build`,即可在dist目录下生成静态资源。

** 数据来源 **
为演示需要,本项目固定使用KlineChart的假数据,如需使用真实数据,请在src/lib/mydatafeed.ts中取消注释改为自己的接口

** 云端指标 **
本项目原生支持云端指标加载和显示,后端需提供`/kline/all_inds``/kline/calc_ind`接口,具体参数请参考`src/lib/indicators/cloudInds.ts`

## TODO
* 覆盖物从localstorage中恢复
* textBox多行文本边界计算不正确
* 滚动条样式未全局生效

# sv

Everything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli).

## Creating a project

If you're seeing this, you've probably already done this step. Congrats!

```bash
# create a new project in the current directory
npx sv create

# create a new project in my-app
npx sv create my-app
```

## Developing

Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:

```bash
npm run dev

# or start the server and open the app in a new browser tab
npm run dev -- --open
```

## Building

To create a production version of your app:

```bash
npm run build
```

You can preview the production build with `npm run preview`.

> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
Binary file added dist.zip
Binary file not shown.
33 changes: 33 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import prettier from "eslint-config-prettier";
import js from '@eslint/js';
import svelte from 'eslint-plugin-svelte';
import globals from 'globals';
import ts from 'typescript-eslint';

export default ts.config(
js.configs.recommended,
...ts.configs.recommended,
...svelte.configs["flat/recommended"],
prettier,
...svelte.configs['flat/prettier'],
{
languageOptions: {
globals: {
...globals.browser,
...globals.node
}
}
},
{
files: ["**/*.svelte"],

languageOptions: {
parserOptions: {
parser: ts.parser
}
}
},
{
ignores: ["build/", ".svelte-kit/", "dist/"]
}
);
136 changes: 136 additions & 0 deletions messages/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
{
"$schema": "https://inlang.com/schema/inlang-message-format",
"time_": "Time",
"open_": "Open",
"high_": "High",
"low_": "Low",
"close_": "Close",
"volume_": "Volume",
"change_": "Change",
"timeframe": "Timeframe",
"no_data": "No Data",
"indicator": "Indicator",
"timezone": "Timezone",
"setting": "Setting",
"confirm": "Confirm",
"cancel": "Cancel",
"symbol_search": "Search Symbol",
"no_ind_params": "This indicator has no parameters",
"search": "Search",
"settings": "Settings",
"screenshot": "Screenshot",
"grid_show": "Grid Show",
"restore": "Restore",
"reset": "Reset",

"candle_type": "Candlestick Type",
"candle_solid": "Solid",
"candle_stroke": "Hollow",
"candle_up_stroke": "Up Hollow",
"candle_down_stroke": "Down Hollow",
"ohlc": "OHLC",
"area": "Area",

"price_axis_type": "Price Axis Type",
"reverse_coordinate": "Reverse Coordinate",
"last_price_show": "Show Last Price",
"high_price_show": "Show High Price",
"low_price_show": "Show Low Price",
"indicator_last_value_show": "Show Indicator Last Value",
"param": "Param ",
"period": "Period",
"standard_deviation": "StdDev",
"normal": "Normal",
"percentage": "Percentage",
"log": "Log",

"num_bar": " Bars",
"days": "days",
"hours": "hours",
"mins": "mins",
"minute": "Minutes",
"hour": "Hours",
"day": "Days",
"week": "Weeks",
"month": "Months",

"horizontal_straight_line": "Horizontal Straight Line",
"horizontal_ray_line": "Horizontal Ray Line",
"horizontal_segment": "Horizontal Segment",
"vertical_straight_line": "Vertical Straight Line",
"vertical_ray_line": "Vertical Ray Line",
"vertical_segment": "Vertical Segment",
"straight_line": "Straight Line",
"ray_line": "Ray Line",
"segment": "Segment",
"arrow": "Arrow",
"price_line": "Price Line",
"price_channel_line": "Price Channel Line",
"parallel_straight_line": "Parallel Straight Line",
"fibonacci_line": "Fibonacci Retracement Line",
"fibonacci_segment": "Fibonacci Retracement Segment",
"fibonacci_circle": "Fibonacci Circle",
"fibonacci_spiral": "Fibonacci Spiral",
"fibonacci_speed_resistance_fan": "Fibonacci Speed Resistance Fan",
"fibonacci_extension": "Fibonacci Extension",
"gann_box": "Gann Box",
"rect": "Rectangle",
"parallelogram": "Parallelogram",
"circle": "Circle",
"triangle": "Triangle",
"three_waves": "Three Waves",
"five_waves": "Five Waves",
"eight_waves": "Eight Waves",
"any_waves": "Any Waves",
"abcd": "ABCD Pattern",
"xabcd": "XABCD Pattern",
"weakMagnet": "Weak Magnet Mode",
"strongMagnet": "Strong Magnet Mode",

"MA": "Moving Average",
"EMA": "Exponential Moving Average",
"SMA": "Simple Moving Average",
"BOLL": "Bollinger Bands",
"SAR": "Parabolic SAR",
"BBI": "Bull and Bear Index",
"VOL": "Volume",
"MACD": "Moving Average Convergence Divergence",
"KDJ": "KDJ Index",
"RSI": "Relative Strength Index",
"BIAS": "Bias",
"BRAR": "Bull and Bear Ratio",
"CCI": "Commodity Channel Index",
"CR": "Energy",
"PSY": "Psychological Line",
"DMA": "Parallel Line Difference",
"TRIX": "Triple Exponential Moving Average",
"OBV": "On Balance Volume",
"VR": "Volume Variation Rate",
"WR": "Williams Percentage Range",
"MTM": "Momentum",
"EMV": "Ease of Movement",
"ROC": "Rate of Change",
"PVT": "Price Volume Trend",
"AO": "Awesome Oscillator",
"DMI": "Directional Movement Index",

"utc": "Coordinated Universal Time (UTC)",
"honolulu": "(UTC-10) Honolulu",
"juneau": "(UTC-8) Juneau",
"los_angeles": "(UTC-7) Los Angeles",
"chicago": "(UTC-5) Chicago",
"toronto": "(UTC-4) Toronto",
"sao_paulo": "(UTC-3) São Paulo",
"london": "(UTC+1) London",
"berlin": "(UTC+2) Berlin",
"bahrain": "(UTC+3) Bahrain",
"dubai": "(UTC+4) Dubai",
"ashkhabad": "(UTC+5) Ashkhabad",
"almaty": "(UTC+6) Almaty",
"bangkok": "(UTC+7) Bangkok",
"shanghai": "(UTC+8) Shanghai",
"tokyo": "(UTC+9) Tokyo",
"sydney": "(UTC+10) Sydney",
"guadalcanal": "(UTC+11) Solomon Islands",
"auckland": "(UTC+12) Auckland"
}
Loading

0 comments on commit f8bee16

Please sign in to comment.