# 1. 需求分析
本次实验我实现的是一个基金交易系统。
本系统实际上不是由用户进行操作,而是由管理员进行操作。本系统需要实现几个功能。第一,需要能查看当前市场上所有的基金的信息,包括编号、基金名、股价。第二,要能生成基金交易记录,交易记录包含交易编号、交易用户、交易基金、购买股数。除了能生成新的交易,系统还应该能删除交易、修改旧交易、查找交易。第三,需要能查看所有的交易记录信息。
# 2. 数据库设计
数据库 ER 图如下:
![](https://www.writebug.com/myres/static/uploads/2022/7/30/dcae40ca7692024c815a62a33425cfb0.writebug)
关系数据库共两张表。
第一张表记录基金信息,共有三种属性,包括基金编号,基金名称,基金单股价格。其中主键为基金编号。每种属性都有非空限制,并且全都是字符串变量。
第二张表记录交易信息,共有四种属性,包括交易编号,交易用户姓名,交易基金的编号,交易的股数。其中主键为交易编号。每种属性均有非空限制,其中交易编号为自增主键,为 Int 型,其余为字符串变量。
关系数据库展示如下
表一:
![](https://www.writebug.com/myres/static/uploads/2022/7/30/f08088e0394c368b1d9fd8b22ab9015a.writebug)
表二:
![](https://www.writebug.com/myres/static/uploads/2022/7/30/ac6f8a369e384f0050931483c74b7c56.writebug)
关系数据库生成代码:
```c++
CREATE DATABASE 'test1';
CREATE TABLE `test1`.`foundation` (
`foundationid` INT NOT NULL,
`foundation` VARCHAR(20) NOT NULL,
`price` DOUBLE NOT NULL,
PRIMARY KEY (`foundationid`));
CREATE TABLE `test1`.`people` (
`id` INT NOT NULL AUTO_INCREMENT,
`name` VARCHAR(10) NOT NULL,
`foundationid` VARCHAR(10) NOT NULL,
`shares` VARCHAR(10) NOT NULL,
PRIMARY KEY (`id`));
```
# 3. 系统展示
系统主界面如下:
![](https://www.writebug.com/myres/static/uploads/2022/7/30/170029869297420d17492ac6b1681bba.writebug)
点击基金市场会展示当前市场上所有基金的信息,包括基金编号、基金名称、基金单股价格。
![](https://www.writebug.com/myres/static/uploads/2022/7/30/f5ae3df592bdcf9e2f261aff585e137d.writebug)
点击交易记录会显示目前记录的所有交易信息,包含交易编号,交易用户姓名,交易的基金编号,交易的股数。
![](https://www.writebug.com/myres/static/uploads/2022/7/30/5cc307a9c9ddacb6bab2564bfa99ce81.writebug)
点击交易按钮会显示交易窗口,可以对交易信息进行更改,包括增加、删除、修改、搜索交易。
![](https://www.writebug.com/myres/static/uploads/2022/7/30/2967ad1add347cc156995b6539af4cb6.writebug)
增加交易会要求输入用户姓名、购买的基金编号和股数。输入信息点击确认后,就会增加一条交易记录。例如,我们增加一条交易信息,用户名为 zhou,购买 3 号基金,购买 400 股。
![](https://www.writebug.com/myres/static/uploads/2022/7/30/993b9bb98a595afcb9bf4ecb040622fe.writebug)
确认之后会有弹窗弹出
![](https://www.writebug.com/myres/static/uploads/2022/7/30/73f4c1e60068fa2eb07227b703d928c7.writebug)
去交易记录窗口查看目前记录的交易信息,增加成功
![](https://www.writebug.com/myres/static/uploads/2022/7/30/248c0713c3251938d859a5cfffff11be.writebug)
修改交易与增加类似,例如,将刚刚的交易内容股数改为 500
![](https://www.writebug.com/myres/static/uploads/2022/7/30/802bb60a8a8ef82521e6db72728f5c2e.writebug)
点击确认后,查看交易记录,修改成功
![](https://www.writebug.com/myres/static/uploads/2022/7/30/461bb90abdfeffc63b646272f39b59f4.writebug)
删除操作只需要输入用户名和购买的基金编号即可。例如,将用户 zhou 购买 3 号基金的交易删除:
![](https://www.writebug.com/myres/static/uploads/2022/7/30/5d38b51c3d4180c8568ec045ee1f413e.writebug)
![](https://www.writebug.com/myres/static/uploads/2022/7/30/1027e2353673012791fa48727047652c.writebug)
搜索可以按照用户名或者基金编号进行搜索
![](https://www.writebug.com/myres/static/uploads/2022/7/30/1eae9c4e7ba4ebbd2bbdae3e30c130f5.writebug)
例如,对于如下的交易记录:
![](https://www.writebug.com/myres/static/uploads/2022/7/30/34f6fb1fd28004f408e2e1539531fbe9.writebug)
若按姓名搜索 zhou,结果如下:
![](https://www.writebug.com/myres/static/uploads/2022/7/30/fd740577b4e9f9e73ddc6f5df04ab23a.writebug)
若按基金编号搜索 4,结果如下:
![](https://www.writebug.com/myres/static/uploads/2022/7/30/8205e1ed6d13406f921b001ed4a62162.writebug)
基于Python实现基金交易系统【100011191】
版权申诉
23 浏览量
2023-03-09
10:23:01
上传
评论
收藏 1.07MB ZIP 举报
神仙别闹
- 粉丝: 2704
- 资源: 7645
最新资源
- Screenshot_20240528_103010.jpg
- 基于Python的新能源承载力计算及界面设计源码 - HAINING-DG
- 基于Java的本科探索学习项目设计源码 - 本科探索
- 基于Javascript和Python的微商城项目设计源码 - MicroMall
- 基于Java的网上订餐系统设计源码 - online ordering system
- 基于Javascript的超级美眉网络资源管理应用模块设计源码
- 基于Typescript和PHP的编程知识储备库设计源码 - study-php
- Screenshot_2024-05-28-11-40-58-177_com.tencent.mm.jpg
- 基于Dart的Flutter小提琴调音器APP设计源码 - violinhelper
- 基于JavaScript和CSS的随寻订购网页设计源码 - web-order
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈