Skip to main content

Toolkit with functions designed to extract various information from JK contracts

Project description

jk_contract 提取合同章节、小节、首页、风险级别

暂时不支持广发

安装方法

命令行输入pip install jk_contract

创建新的.py文件,输入:

-*- coding: GBK -*-

import jk_contract as jk

函数

单个合同文件

contract = jk.Contract('[合同文件路径]')

print(contract.get_risk_level() # 输出风险等级)

print(contract.get_chapter('[章节(如:基金的投资)]' # 输出章节内容)

print(contract.get_section_of_chapter('[章节]', '[小节(如:投资限制、投资范围)]' #输出小节内容)

多个合同文件

contracts = jk.Contracts('合同文件夹路径')

提取内容可以是章节或者章节内小节:

content = contracts.get_chapters('[章节]')

content = contracts.get_sections('[章节]', '[小节]') #若提取多于一个小节,[小节]需要为list(参照使用案例)

将提取内容以基金产品名字作为index生成dataframe:

df = contracts.get_df(content)

最后将df导出成excel:

contracts.to_excel(df, '[导出路径]+[导出excel文件名称].xlsx')

举例:

contracts.to_excel(df, '~/Desktop/output.xlsx')

使用案例(提取投资限制和投资范围)

方法1:创建新python文件
# -*- coding: GBK -*-

import jk_contract as jk

contracts = jk.Contracts('/Users/andy/Desktop/work/ubiquant/合同提取/所有合同')
contents = contracts.get_sections('基金的投资', ['投资限制', '投资范围'])
contracts.to_excel(contracts.get_df(contents), '~/Desktop/output.xlsx')
方法2:命令行

打开命令行输入:

jk_contract [input路径(如:'/Users/andy/Desktop/work/ubiquant/合同提取/所有合同')] [output路径(如:/Users/andy/Desktop/work/ubiquant/合同提取/output.xlsx)] [章节(如:基金的投资)] [小节(如:投资范围 投资限制)(注:小节可以多于一个)]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jk_contract-1.0.5.tar.gz (10.7 kB view details)

Uploaded Source

Built Distributions

jk_contract-1.0.5-py3.10.egg (17.1 kB view details)

Uploaded Source

jk_contract-1.0.5-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file jk_contract-1.0.5.tar.gz.

File metadata

  • Download URL: jk_contract-1.0.5.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for jk_contract-1.0.5.tar.gz
Algorithm Hash digest
SHA256 e98847f02fd27795cd1e812562e829efa7d5895977a67a46f03b1ddd26da1660
MD5 1990a52fa02e20433696e0ad7562b557
BLAKE2b-256 90983238ae029c346dac7e4d82eedb3ed9a617956a2a0e9e0c9b4c050832f303

See more details on using hashes here.

File details

Details for the file jk_contract-1.0.5-py3.10.egg.

File metadata

  • Download URL: jk_contract-1.0.5-py3.10.egg
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for jk_contract-1.0.5-py3.10.egg
Algorithm Hash digest
SHA256 ea5e23c0894746b89662e9dea88d48b85081b947ba7b54dcbe977d03d5460384
MD5 8e17b30aca8de18db7e8f0b272a1e04c
BLAKE2b-256 ea201da2ada77a37bf989d7f094308cfc6113a03f8000d4d11649373c6cd4977

See more details on using hashes here.

File details

Details for the file jk_contract-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: jk_contract-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for jk_contract-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 fc782d3f99ae97f7db77f5cd9767ee18a392169e4c1eba832c4f0d5b6bff3821
MD5 4dee876ad4340d1a3022a1ac3a3d2e66
BLAKE2b-256 cb8d5cd7d3c7a62716a1815d7b6252cb0ff73327124f1e1b286125fc49d8f685

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page