Giter VIP home page Giter VIP logo

ebest.openapi's Introduction

NuGet version eBEST.OpenApi C# Wrapper

eBEST.OpenApi는 eBEST OpenAPI를 C#에서 사용하기 위한 Wrapper입니다.

개발환경

Visual Studio 2022, NET48, NET8.0
(DeveCenter 프로젝트 https://github.com/teranum/eBEST.OpenApi.DevCenter)

사용법

1. eBEST.OpenApi nuget 패키지를 참조 합니다.

* InOutBlocks, TR Models 확장 용 사용 시에는 eBEST.OpenApi.Models 패키지를 참조
* 일부TR 응답 시, 매뉴얼과 실제 응답 데이터가 차이 나는 경우가 있습니다. 확인 후 사용 하시기 바랍니다.

2. eBEST.OpenApi.EBestOpenApi 클래스

	// 프로퍼티
	ServerType: 로그인 서버 타입 (실투자, 모의투자)
	bool Connected: 서버연결상태 (true:연결, false:연결해제)
	string LastErrorMessage: 마지막 에러 메시지
	string MacAddress: MAC 주소, 법인계좌시 필수 세팅

	// 메소드
	ValueTask<bool> ConnectAsync : 비동기 로그인 요청 (true: 연결성공, false: 연결실패)
	ValueTask<bool> AddAccountRealtimeRequest : 실시간 계좌정보 요청 (true: 요청성공, false: 요청실패)
	ValueTask<bool> RemoveAccountRealtimeRequest : 실시간 계좌정보 요청 취소 (true: 요청성공, false: 요청실패)
	ValueTask<bool> AddRealtimeRequest : 실시간 요청 (true: 요청성공, false: 요청실패)
	ValueTask<bool> RemoveRealtimeRequest : 실시간 요청 취소 (true: 요청성공, false: 요청실패)
	ValueTask<bool> GetTRData : TR 요청 (true: 요청성공, false: 요청실패)
	ValueTask<(string tr_cd, string tr_cont, string tr_cont_key, string jsonResponse)> GetDataWithJsonString : JSON 요청
	long GetExpires() : 접근토큰 유효기간()

	// 이벤트
	OnConnectEvent : 로그인 이벤트 (로그인 성공 또는 연결해제시 발생)
	OnMessageEvent : 서버 메시지 이벤트 (서버에서 메시지를 보낼때 또는 웹소켓 메시지 타입 오류일 때 발생)
	OnRealtimeEvent : 실시간 웹소켓 이벤트 (실시간 웹소켓 메시지를 받을때 발생)

3. 클래스 생성/로그인후 TR을 요청 합니다.

	_client = new eBEST.OpenApi.EBestOpenApi();
	_client.OnConnectEvent += (sender, e) =>
	{
		if (e.Ok)
		{
			// 로그인 성공
		}
		else
		{
			// 로그인 실패
		}
	};

	// 로그인
	_client.ConnectAsync(AccKey, AccSecretKey);


// TR 현재가 요청 ("005930" 입력시 삼성전자 현재가 요청)
void Test(string code)
{
    t1102 주식현재 = new()
    {
        t1102InBlock = new(code),
    };
    _client.GetTRData(주식현재가).Wait();
    if (주식현재가.t1102OutBlock != null)
    {
        ResultText += $"\r\n{주식현재가.t1102OutBlock}";
    }
}
	

업데이트

version 1.4.0

eBEST.OpenApi.Abstractions 추가

version 1.3.0

MacAddress 프로퍼티 추가
비동기요청메소드 리턴 변경 : Task -> ValueTask

version 1.2.0

net48, net8.0지원

version 1.1.1

eBEST.OpenApi.Models 에 xml Document file 추가

version 1.1.0

eBEST.OpenApi 에서 Models/Blocks 를 eBEST.OpenApi.Models 로 분리

version 1.0.0

초기 eBEST.OpenApi.OpenApi nuget package 게시

ebest.openapi's People

Contributors

teranum avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

www2341 minari2

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.