Giter Site home page Giter Site logo

okklineswift's Introduction

OKKLineSwift

😄 OKKLineSwift is written in Swift3 to draw the stock K-line library

Screenshot

iOS Screenshot [Support drag gestures, long press gestures (see details), knead gestures (zoom in)]

OKKLineSwift

macOS Screenshot [Support drag events, crosshairs follow, mouse scrolling events (zoom in)]

OKKLineSwift

Support

Swift 3.0

iOS 8+

macOS 10.10+

Installation

Manually

  1. Download the full file.
  2. Drag the OKKLineSwift folder to your project.

Source directory

Directory Description
Configuration OKConfiguration.swift - This is a global control class that controls the global theme (e.g. color, font size, etc.)
Views OKKLineView - This class is the parent view of all views
OKKLineDrawView.swift - This class is a parent view of all K-line views that handle gestures and data sources
OKValueView.swift - Responsible for drawing prices
1、MainView:
OKKLineMainView.swift - Responsible for drawing the main graph
2、VolumeView:
OKKLineVolumeView.swift - Responsible for drawing the volume view
3、AccessoryView:
OKKLineAccessoryView.swift - Responsible for drawing the index view
4、SegmentView:
OKSegmentView.swift - Responsible for displaying timeline or indicator type
Models Data model directory, mainly K-line data and a variety of indicators model
Tools Tool class directory,for example:
OKLineBrush.swift - Responsible for drawing lines
OKMALineBrush.swift - Responsible for drawing the average class

TODO

  • Support macOS system
  • Support for more metric types

Licenses

All the OK at the beginning of the project source code to comply with MIT license. Copyright (c) 2016 Herb. All rights reserved.

Contributions

Welcome to contribute to your ideas and code! You can pull requests and issues here! 👏

okklineswift's People

Contributors

herbsun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

okklineswift's Issues

请问加载历史数据功能吗?

看了你的iOS Demo ,默认是加载300条数据,如果我还要看以前的历史数据,你这套组件可以支持这个功能吗?

Drag gesture issue

Hey @Herb-Sun, Thanks for this library but i am facing issue while drag gesture it does not displaying proper value and displaying two label instead of only one label. Please check below image :

Screenshot 2019-04-25 at 11 34 42 AM

Please Help me!

程序bug

模拟器,iPhone 6s, iOS10.1(14B72)。点击MA与BOLL之间的EMA按钮时,程序崩溃在OKKLineMainView.swift(Line 303)。
堆栈信息:2016-12-31 16:07:12.425559 OKKLineSwift-iOS-Demo[2299:154750] [] nw_socket_set_common_sockopts setsockopt SO_NOAPNFALLBK failed: [42] Protocol not available, dumping backtrace:
[x86_64] libnetcore-856.20.4
0 libsystem_network.dylib 0x000000011149c682 __nw_create_backtrace_string + 123
1 libnetwork.dylib 0x0000000111779932 nw_socket_add_input_handler + 3100
2 libnetwork.dylib 0x00000001117574f4 nw_endpoint_flow_attach_protocols + 3768
3 libnetwork.dylib 0x0000000111756511 nw_endpoint_flow_setup_socket + 563
4 libnetwork.dylib 0x0000000111755270 -[NWConcrete_nw_endpoint_flow startWithHandler:] + 2612
5 libnetwork.dylib 0x000000011177044d nw_endpoint_handler_path_change + 1261
6 libnetwork.dylib 0x000000011176fe7c nw_endpoint_handler_start + 570
7 libnetwork.dylib 0x0000000111787ae5 nw_endpoint_resolver_start_next_child + 2240
8 libdispatch.dylib 0x0000000111219980 _dispatch_call_block_and_release + 12
9 libdispatch.dylib 0x00000001112430cd _dispatch_client_callout + 8
10 libdispatch.dylib 0x0000000111220e6b _dispatch_queue_serial_drain + 236
11 libdispatch.dylib 0x0000000111221b9f _dispatch_queue_invoke + 1073
12 libdispatch.dylib 0x00000001112243b7 _dispatch_root_queue_drain + 720
13 libdispatch.dylib 0x000000011122408b _dispatch_worker_thread3 + 123
14 libsystem_pthread.dylib 0x00000001115ec4de _pthread_wqthread + 1129
15 libsystem_pthread.dylib 0x00000001115ea341 start_wqthread + 13
POST https://www.btc123.com/kline/klineapi?size=300&symbol=okcoincnbtccny&type=5min 200
fatal error: Index out of range

BOLL指标算法错误

日BOLL指标计算为例,
其计算方法如下:
1.日BOLL指标的计算公式
中轨线=N日的移动平均线
上轨线=中轨线+两倍的标准差
下轨线=中轨线-两倍的标准差

2.日BOLL指标的计算过程
(1)计算MA MA=N日内的收盘价之和÷N
(2)计算标准差MD MD=平方根N日的(C-MA)的两次方之和除以N
(3)计算MB、UP、DN线
MB=(N-1)日的MA
UP=MB+2×MD
DN=MB-2×MD

伪代码如下:
中轨:MB=SMA(n-1)=(C1+C2+C3+…+C(n-1))/(n-1))
标准差:MD ={[(C1-SMAn)^2+…+(Cn-SMAn)^2]/n}^0.5
上轨:UP=MB + kMD
下轨:DN=MB - K
MD

根据上面的公式,你的标准差的计算明显有问题。

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.